luciano_castro Posted October 9, 2009 Share Posted October 9, 2009 Using IReport 3.5.2, when i try to read fields from a query using the check box "Automatically retrieve fields" or pressing "Read Fields" button, i receive this message: "Error:null "Looking at IDE's Log file, i found this exception:java.lang.NullPointerException at com.jaspersoft.ireport.designer.data.ReportQueryDialog.recursiveInterpreter(ReportQueryDialog.java:1843) at com.jaspersoft.ireport.designer.data.ReportQueryDialog$FieldReader.run(ReportQueryDialog.java:546)The Database connection seems to be ok, I can preview the report using it.the full log file is attached.Is it a bug or i'm missing some configuration? Link to comment Share on other sites More sharing options...
luciano_castro Posted October 14, 2009 Author Share Posted October 14, 2009 should i give more info on the problem? anyone else having the same problem? thanks _o/ Link to comment Share on other sites More sharing options...
iancr01 Posted October 15, 2009 Share Posted October 15, 2009 Can you run the same query against the DBMS (Copy to Clipboard and paste into a query tool)? What DBMS is it? Link to comment Share on other sites More sharing options...
luciano_castro Posted October 15, 2009 Author Share Posted October 15, 2009 hi iancr01 !The query is fine, actually any query that i use produces the error, even the easiest ones like 'select id from my_table'.I put the fields manually into the report, compiled it and used it with my application. The report worked just like i expected.The only problem is when i try to read the fields.tks for the reply=) Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted February 10, 2010 Share Posted February 10, 2010 The error seems to come from the parameters in the query. Can you give us your query and tell us how did you define parameters and their default value expressions?Giulio Link to comment Share on other sites More sharing options...
mmflynn Posted February 10, 2010 Share Posted February 10, 2010 Hi luciano_castro,Giulio and I came across your post while troubleshooting the same error message from a customer. It seems like it's a subtle design issue. I can recreate your scenario by creating two simple parameters: parameter1, type string, no default value parameter2, type string, default value = $P{parameter1}iReport returns Error:null when you click Read Fields in the Report query box.In this scenario the default value for parameter2 is "null" because that's the value for parameter1. Set a default value for parameter1 and the field list is returned.It seems like you may have a similar issue where at least one parameter has a default value that is evaluating to null. In my customer's case the default value is being set by a custom method and we need to work that out. In your case I hope it's as simple as the example above.Good luck!Mary FlynnJaspersoft sales engineer Link to comment Share on other sites More sharing options...
softwareguy Posted February 29, 2012 Share Posted February 29, 2012 I'm running into a similar error when attempting to "Read Fields" using my custom Fields Provider.Ensuring that all the parameters in the report have valid defaultValueExpressions (as suggested above) seem to be doing the trick.... except when I try to use my custom REPORT_SCRIPTLET within the default expression, such as: <parameter name="ToDate" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[$P{REPORT_SCRIPTLET}.getFormattedDate()]]></defaultValueExpression> </parameter> Is there a trick to ensuring that the REPORT_SCRIPTLET parameter itself is initialized? Link to comment Share on other sites More sharing options...
softwareguy Posted March 3, 2012 Share Posted March 3, 2012 FYI: I found that if I try to instantiate my custom REPORT_SCRIPTLET in the parameter using something like this: <parameter name="ToDate" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[new my.company.reports.MyReportScriptlet().getFormattedDate()]]></defaultValueExpression></parameter> ...that appears to allow the "Read Fields" functionality to work.I'm guessing that is not the safest way becaues it looks like instantiating my custom report scriptlet myself ... causes certain other parameters that the report scriptlet methods might depend on ... such as REPORT_LOCALE may not get set propertly. But at least it seems to work for static/independent methods in the report scriptlet that perform simple functions that don't need other parameters or environmental settings. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now