JasperReports and Java 8
I was asked to look at an error being experienced running a report. The error is:
Failed to create report: Errors were encountered when compiling report expressions class file:
1. The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
value = (java.lang.String)((((java.lang.String)field_displayName.getValue()).contains("Payment")) ? //$JR_EXPR_ID=23$
Investigation shows:
a) the OpenVPMS system in question is running Java 8
b) as per http://community.jaspersoft.com/jasperreports-server/issues/3498 this would appear to be a problem associated with the use of Java 8 rather than 7
Q1: any disagreement with my planned action of removing Java 8 and installing Java 7 ?
Q2: our readme says "Java Platform, Standard Edition 7 or higher" - so technically the use of 8 is within the guidelines. I think that we should reword the readme to be a little tighter - ie remove the "or higher". [Note that the same problem occurs with MySQL - 5.6 which is within the "MySQL 5.1.53 or higher" guideline certainly does not work. Perhaps we should change to a statement like "Java Platform, Standard Edition 7 - highest version tested = 7.7"
Regards, Tim G
Re: JasperReports and Java 8
I reckon the best check here is to run the report straight from ireports. using the engine in reports - that will assess whether its a still current ireports bug v something in ireports 3.7 or earlier and openvpms.
It will assess the need to move to a higher version of ireports in 1.8 as well.
Re: JasperReports and Java 8
I will also note that I have been running my dev version builds against mysql 5.6 and have not experienced errors.
Re: JasperReports and Java 8
Ben - good idea to run report from within iReports - but the problem is within the Statement, not a Report. However, I know the syntax that is causing the error and hence can tweak a report to use the problematic code and try that.
[I could also try installing Java 8 on my development laptop, and see what happens (I should be able to have both 7 & 8 installed and switch by changing the java-home setting.)]
Regards, Tim G
Re: JasperReports and Java 8
OK - I have confirmed the problem. What I did was download and install Java 8, then adjusted the JAVA_HOME environment variable from C:\Program Files\Java\jre7 to C:\Program Files\Java\jre8 and then (because I have Tomcat installed as a service) ran C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\Tomcat6w.exe [on Win7 and I assume 8, you need to run this as Administrator] and in the Java tab, set jre8 as shown below.
I then ran the problematic statement and got:
Note that this statement is modified from the standard as follows:
The standard statement uses:
ie it just prints the $F{displayName} field without trying to be sexy.
The actual code that causes the problem with Java8 is the $F{displayName}.contains("Payment")
Conclusion: we are not ready for Java8.
Regards, Tim G
Re: JasperReports and Java 8
Thanks.
I've updated the readme.txt in the release package to note that Java 8 is not supported.
Re: JasperReports and Java 8
Tim,
can you upload that file for testing against a patch
Cheers Ben
Re: JasperReports and Java 8
Ben - it was a tweaked version of the statement. I have attached both the statement and the starement items jrxml. The problem is caused by the $F(displayName).contains(...) - see below. Regards, Tim G