Jump to content

InvalidClassException?


2005 IR Help

Recommended Posts

By: Mike Coxon - largesnike

InvalidClassException?

2004-04-06 18:45

I have generated a .jasper file based on the LandscapeApp example through a modified ant script that combines the Jasper compilation stage with the rest of my compilation tasks. I then feed that .jasper file into the

 

JasperFillManager.fillReportToFile(fileName, null, new JREmptyDataSource());

 

method in LandscapeApp.java

 

and I get :::

 

java.io.InvalidClassException: dori.jasper.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 501, local class serialVersionUID = 502

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)

at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:128)

at dori.jasper.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:234)

at au.com.dot.viperbase.reporting.LandscapeApp.main(LandscapeApp.java:142)

 

NESTED BY :

java.io.InvalidClassException: dori.jasper.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 501, local class serialVersionUID = 502

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)

at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:128)

at dori.jasper.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:234)

at au.com.dot.viperbase.reporting.LandscapeApp.main(LandscapeApp.java:142)

 

NESTED BY :

dori.jasper.engine.JRException: Error loading object from file : C:usrlocalviperbasecop_ideaaucomdotviperbasereportingLandscapeReport.jasper

at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:132)

at dori.jasper.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:234)

at au.com.dot.viperbase.reporting.LandscapeApp.main(LandscapeApp.java:142)

Caused by: java.io.InvalidClassException: dori.jasper.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 501, local class serialVersionUID = 502

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)

at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:128)

... 2 more

 

why am I getting this? I only just compiled the thing.

 

cheers,

Mike

 

 

 

 

By: Mike Coxon - largesnike

RE: InvalidClassException?

2004-04-06 20:59

PS:

 

I am using the jasperreports-0.5.2.jar library that was supplied to me buy the same distribution

 

 

 

 

By: Chuck Deal - cdeal

RE: InvalidClassException?

2004-04-07 06:01

Your report was compiled by a different version of Jasper than you you are trying to use to fill it. Somewhere on your classpath you have a reference to a Jasper 0.5.1 library.

 

 

 

 

By: Mike Coxon - largesnike

RE: InvalidClassException?

2004-04-07 19:03

the following is my complete classpath:

 

-classpath C:usrlocalviperbasecop_idea;

C:j2sdk1.4.1_01jrelibcharsets.jar;

C:j2sdk1.4.1_01jrelibjaws.jar;

C:j2sdk1.4.1_01jrelibjce.jar;

C:j2sdk1.4.1_01jrelibjsse.jar;

C:j2sdk1.4.1_01jrelibrt.jar;

C:j2sdk1.4.1_01jrelibsunrsasign.jar;

C:j2sdk1.4.1_01jrelibextdnsns.jar;

C:j2sdk1.4.1_01jrelibextldapsec.jar;

C:j2sdk1.4.1_01jrelibextlocaledata.jar;

C:j2sdk1.4.1_01jrelibextsunjce_provider.jar;

C:usrlocalvexbuildlibj2ee.jar;

C:usrlocalvexbuildjasperreportslibant-1.5.1.jar;

C:usrlocalvexbuildjasperreportslibbsh-1.3.0.jar;

C:usrlocalvexbuildjasperreportslibcommons-beanutils-1.5.jar;

C:usrlocalvexbuildjasperreportslibcommons-collections-2.1.jar;

C:usrlocalvexbuildjasperreportslibcommons-digester-1.3.jar;

C:usrlocalvexbuildjasperreportslibcommons-logging-1.0.2.jar;

C:usrlocalvexbuildjasperreportslibcommons-logging-api-1.0.2.jar;

C:usrlocalvexbuildjasperreportslibhsqldb-1.61.jar;

C:usrlocalvexbuildjasperreportslibitext-1.01.jar;

C:usrlocalvexbuildjasperreportslibpoi-2.0-final-20040126.jar;

C:usrlocalvexbuildjasperreportslibservlet.jar;

C:usrlocalvexbuildjasperreportslibxercesImpl.jar;

C:usrlocalvexbuildjasperreportslibxmlParserAPIs.jar;

C:usrlocalvexbuildjasperreportsdistjasperreports-0.5.2.jar;

C:usrlocalvexbuildlibcrimson.jar;

C:usrlocalvexbuildlibdb2java.zip;

C:usrlocalvexbuildlibdotkb.jar;

C:usrlocalvexbuildlibevwcorba-raw.jar;

C:usrlocalvexbuildlibevwfrontend.jar;

C:usrlocalvexbuildlibjaxp.jar;

C:usrlocalvexbuildlibjCharts-0.6.0.jar;

C:usrlocalvexbuildlibjfreechart-0.9.8.jar;

C:usrlocalvexbuildlibldapfilt.jar;

C:usrlocalvexbuildlibldapjdk.jar;

C:usrlocalvexbuildlibldapsp.jar;

C:usrlocalvexbuildlibmail.jar;

C:usrlocalvexbuildlibmailapi.jar;

C:usrlocalvexbuildlibutils.jar;

C:usrlocalvexbuildlibxalan.jar;

C:usrlocalvexbuildpcube-libbl.jar;

C:usrlocalvexbuildpcube-libcollections1.1.8.jar;

C:usrlocalvexbuildpcube-libhelp.jar;

C:usrlocalvexbuildpcube-libjbcl.jar;

C:usrlocalvexbuildpcube-libjcdatasource451K.jar;

C:usrlocalvexbuildpcube-libjcfield451K.jar;

C:usrlocalvexbuildpcube-libjctable451K.jar;

C:usrlocalvexbuildpcube-libjdmkrt1.1.8.jar;

C:usrlocalvexbuildpcube-libjh.jar;

C:usrlocalvexbuildpcube-liblog4j.jar;

C:usrlocalvexbuildpcube-libpcubelaf.jar;

C:usrlocalvexbuildpcube-libpolicyconvert.jar;

C:usrlocalvexbuildpcube-libregexp.jar;

C:usrlocalvexbuildpcube-libsmartnetapi.jar;

C:usrlocalvexbuildpcube-libum_core.jar;

C:usrlocalvexbuildpcube-libxerces.jar au.com.dot.viperbase.reporting.LandscapeApp

 

-Tfill -FC:/usr/local/viperbase/cop_idea/au/com/dot/viperbase/reporting/LandscapeReport.jasper

 

 

unfortunately, I'm on windows, so it is hard to come up with a list of the jars that I am pointing to when I use my ant script to compile the .jasper file.

 

I have looked through the list, and indeed throughout my hard drive, and I can assure you I do not even possess a Jasper 0.5.1 library.

 

 

 

 

By: Chuck Deal - cdeal

RE: InvalidClassException?

2004-04-08 05:29

Well, it could simple be called jasperreports.jar (but represent the 0.5.1 release).

 

I don't know what build.xml file you are using for your Ant call to -Tfill, but according the Landscape sample build.xml the classpath is defined as:

 

<property name="classes.dir" value="../../../classes" />

<property name="lib.dir" value="../../../lib" />

<property name="fonts.dir" value="../../fonts" />

<path id="classpath">

<pathelement location="./"/>

<pathelement location="${classes.dir}" />

<pathelement location="${fonts.dir}" />

<fileset dir="${lib.dir}">

<include name="**/*.jar"/>

</fileset>

</path>

 

In your first post, you said you used the Ant task to compile the report and then used a Java app to fill the report. It is possible that the two operations used a different classpath.

 

You might have to simplify your environment by specifically setting a classpath on the Java app that fills the report until you find the culprit. If you search the for on your original error you will find that it is definately a jasperreports version conflict.

 

 

 

 

By: Mike Coxon - largesnike

RE: InvalidClassException?

2004-04-12 21:48

well, I've gone for a really big hunt this time, and I'm now absolutely certain that there are NO other versions of jasper report classes anywhere on my hard drive (I have now inspected the contents of all jars).

 

In my travels through I had a pause to reflect on the line:

 

Caused by: java.io.InvalidClassException: dori.jasper.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 501, local class serialVersionUID = 502

 

notice the serial numbers, could one be referring to a 0.5.1 implementation and the other referring to 0.5.2?

 

If this were the case, am I likely to be tickling a bug in 0.5.2? Perhaps JRBaseReport is actually broken in a way such that it doesn't support my build?

 

I will have to go through a substantial rebuild to test this, so if anyone has knowledge of any issues here, let me know.

 

 

 

 

By: Teodor Danciu - teodord

RE: InvalidClassException?

2004-04-13 03:55

 

Hi,

 

If you are using the Ant task, make sure you delete

de *.jasper files, because they get recompiled only

if the source XML was modified.

 

I hope this helps.

Teodor

 

 

 

 

 

By: Mike Coxon - largesnike

RE: InvalidClassException?

2004-04-13 19:48

SOLVED!!!!

 

OK, I was getting the exception because the demo comes with some precompiled classes, but are not part of the 0.5.2 jar. The jar is new, but the precomiled classes are legacy from the previous version.

 

when you run an ant script, and you're a bit careless with the patterns, you can pick up these legacy classes. Obviously, when you go and run it, you are supplying an explicit classpath, but when you are compiling it, you are doing it through patterns.

 

Take home message.

 

Make sure you get rid of the precompiled classes, before running the examples. Or simply get them out of the path of you ant script. They are old and shouldn't be there.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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