mlocklin Posted August 22 Share Posted August 22 (edited) I've recently had to switch to Jasper 7.0.0. from 6.19.1. While trying to run a report I get Error loading object from file: myReport.jasper at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:142) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:117) at net.sf.jasperreports.engine.JasperFillManager.getReportSource(JasperFillManager.java:1105) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:652) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:1020) . . . Caused by: java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; incompatible types for field columnCount at java.base/java.io.ObjectStreamClass.matchFields(ObjectStreamClass.java:2207) at java.base/java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:2128) at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:658) at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2078) at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1927) at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2078) at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1927) at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2252) at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1762) at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:540) at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:498) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:138) ... 14 more I was surprised because my Java and jrxml doesn't have any variable called columnCount. I figured this is coming from the jrxml's implicit columnCount attribute within the Report tag. I confirmed this when, by recompiling working 6.19.1 Jasper files and they report the same error. My compiler is set up with a build script that uses the following line in a loop on multiple files: JasperCompileManager.compileReportToFile(srcItem.getAbsolutePath(),outputPath); The only Jasper jars I use in the build script are jasperreports-7.0.0.jar jasperreports-fonts-7.0.0.jar I just want to know what I need to do to compile my jrxml into a usable jasper file. Do I need another jasper jar file? Is there anything I need to do with Jaspersoft Studio 7.0.0 to converter older jrxml? Edited August 22 by mlocklin Link to comment Share on other sites More sharing options...
lucianc Posted August 23 Share Posted August 23 Yes, you need to use Jaspersoft Studio 7 to convert JRXML files to the JasperReports 7 syntax. Then you can use either Studio or JasperReports directly to compile the converted JRXML files. Reports compiled with version 6.x or older will not work with JasperReports 7. Regards, Lucian Link to comment Share on other sites More sharing options...
mlocklin Posted August 26 Author Share Posted August 26 The reports I use have proprietary classes from an external jar. I'm unable to use Jaspersoft Studio's compile button with out getting a cannot resolve to type exception. Is there a way to incorporate a jar into the compile process? Link to comment Share on other sites More sharing options...
mlocklin Posted August 26 Author Share Posted August 26 I was able to find a way to incorporate the jar I needed. I was able to build with Jaspersoft Studios 7. I still get the earlier result. Link to comment Share on other sites More sharing options...
Solution lucianc Posted August 27 Solution Share Posted August 27 The line numbers in the exception stacktrace do not match JasperReports 7.0.0 sources: at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:117) at net.sf.jasperreports.engine.JasperFillManager.getReportSource(JasperFillManager.java:1105) There is no call to JRLoader.loadObject at line 1105 in the 7.0.0 source of JasperFillManager . Make sure you only have JasperReports 7.0.0 on your project's classpath and that there's no other/older version. Link to comment Share on other sites More sharing options...
mlocklin Posted August 28 Author Share Posted August 28 Turns out the other dependencies from jackson (there were many was the culprit. Take is when updating to 7.0.0 makes sure all the old decencies get updated too. 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