Jump to content

Jasper 7.0.0 compiles unuseable Jasper files


Go to solution Solved by lucianc,

Recommended Posts

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 by mlocklin
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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

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

  • Solution

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

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...