Jump to content
We've recently updated our Privacy Statement, available here ×

Cannot tie report compilation error messages to source


max_max_mir

Recommended Posts

I am trying to run a report on JasperServer (which runs fine on iReport with Java - not Groovy), but get the following error messages - actually, 75 error messages!

com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:1. Cannot cast from int to Object                value = (java.lang.Object)(3); //$JR_EXPR_ID=12$                        <------------------->2. Cannot cast from int to Object                value = (java.lang.Object)(2); //$JR_EXPR_ID=13$                        <------------------->3. Cannot cast from int to Object                value = (java.lang.Object)(1); //$JR_EXPR_ID=14$                        <------------------->4. Cannot cast from int to Object                value = (java.lang.Object)(0); //$JR_EXPR_ID=15$                        <------------------->5. Cannot cast from int to Object                value = (java.lang.Object)(3); //$JR_EXPR_ID=22$                        <------------------->

I understand the error message (somewhere there's an integer that I need to cast to the Integer Object, but my problem is I can't figure out where these errors occur. How do I tie these error messages to the source? What are $JR_EXPR_ID=12$ etc.? Can I use iReport (3.7.4) to figure out where these errors occur? The report compiles and runs successfully in iReport with Java, so I can't figure out why these errors show up when I load this to JasperServer?

Any help would be highly appreciated.

 



Post Edited by max_max_mir at 01/12/2011 17:22
Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

shertage
Wrote:

Hi,

Which version of JasperServer do you use? It might be a backward compatibility issue.

This kind of errors are thrown at report compilation time, and if the report compiler is not JDK1.5 compatible, it doesn't support autoboxing.

Hope this helps,

sanda

The JasperServer version is 3.7.0 I believe (is there a way to find out what version it is, if it has already been installed?) and the Java version is 1.6.0_21. I am not sure what autoboxing is, but are you recommending that I upgrade my jasperserver?

Link to comment
Share on other sites

Hi,

JasperServer 3.7.0 is ok, it already is JDK 1.5-compatible. Of course, upgrading to 4.0 still remains a good idea, in order to get its new features, improvements and bug fixes. :)

I continue to think that an unappropriate java compiler class was loaded from the classpath, but have no idea why. Maybe because the first found is the first loaded.

Regarding the compile errors, you can get some valuable information from their message. If you take a look at the first one:

1. Cannot cast from int to Object
value = (java.lang.Object)(3); //$JR_EXPR_ID=12$

you could extract 3 helpful info:

  1. The first line 'Cannot cast from int to Object' suggests that it's a class cast matter.
  2. The JR_EXPR_ID indicates the expression 0-based index, in the same order as they are added into the jrxml template. Ie, JR_EXPR_ID=12 means the 13-th expression defined in the report template.
  3. The 'value = (java.lang.Object)(3);' indicates that the expression's class was declared as java.lang.Object, and, more important, the content of the last brackets pair shows exactly the text you wrote in the expression.

 

One can say that the 13-th expression has the primitive int value 3 and was declared as Object type.

 

Hope this helps,

 

sanda



Post Edited by shertage at 02/09/2011 18:13
Link to comment
Share on other sites

  • 1 month later...

Sanda, I'm having a similar problem but not sure how to track down the expression that is causing the problem (I'm a relative newbie to Jasper and java). When you say the n-th expression defined in the report template, what do you count as an expression - I have defaultValueExpression, variableExpression, initialValueExpression, groupExpression, printWhenExpression - are all these counted?

Thanks

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...