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

cannot assign instance of net.sf.jasperreports.engine.base.JRBaseRectangle


anand_ganesh

Recommended Posts

Team,

I am using IReport 3.5.2 and I am getting this error when I try to create report.

================================================================

ERROR: failed to generate report...
...Error: java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseRectangle to field net.sf.jasperreports.engine.base.JRBasePen.penContainer of type net.sf.jasperreports.engine.JRPenContainer in instance of net.sf.jasperreports.engine.base.JRBasePen

================================================================

Any suggestions please ?

Thanks
Anand

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hello,

Thank you for replying back. I found a workaround (which is not the best one, but it works) for now.

Here is what I found.

http://anandganesh2005.blogspot.com/2011/02/arcims-tomcat-and-ireport-issues.html

If you could please tell me exactly what .jar files I should copy from IReports 4 to place in which location on my server, that will help me.

Thanks
Anand

Link to comment
Share on other sites

Hi,

First, I was thinking the problem resides in the jrxml file, but after reading the issue details it's obvious that it's a classpath matter.
The jasperreports-4.0.0.jar (this is the jar containing both classes involved in the ClassCastException) should be placed either in the app's classpath, or in tomcat's common or shared lib. But once placed this jar, make sure that you removed all other older jasperreports.jar versions from the classpath and/or from the tomcat libs. Then clear the tomcat's cache and restart the server.

To ensure a proper functionality for the JR 4.0, you could also include in the classpath the following jars:

jasperreports-fonts-4.0.0.jar
jasperreports-extensions-3.5.3.jar
jasperreports-chart-themes-4.0.0.jar

Then, if you still have problems, a better place to post this kind of issues is on the dedicated iReport forum.

Hope this helps,
sanda

Link to comment
Share on other sites

Hi Sanda,

Thank you for the reply and the tip.

What happens if there are other WebApps in Tomcat and those Apps need the older version of jasperreports.jar files ?

Should I have to upgrade all apps on the server ?

Or

Is there a way to tell Java to load Jasperreport 4 libraries for this specific application alone ?

Thanks
Anand

Link to comment
Share on other sites

Hi,

All I could say is that different versions of the same jar coexisting in a classpath always generate problems. So, these jars have to be separated somehow. Either by upgrading all apps to use JR4.0 (if possible), or by moving this single app using 4.0 on a separate tomcat server. With all the possible implications of using 2 tomcat instances simultaneously.

Regards,
sanda

Link to comment
Share on other sites

Thank you Sanda for the quick reply.

At this point I know for sure there are three .jar files which if I remove my core Applications ArcIMS and GeoCortex stops working.

jasper-compiler.jar
jasper-compiler-jdt.jar
jasper-runtime.jar

So I have to wait until these apps are ready to use the latest jasper jar files. These are from different third-party vendors.

I sincerely thank you for replying back and providing me tips to make proper decissions.

Have a nice day !

With best regards
Anand

 

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