Jump to content
Changes to the Jaspersoft community edition download ×

NoClassDefFoundError with different JDK's

Recommended Posts

By: Firedragon - firedragon852

NoClassDefFoundError with different JDK's

2003-09-29 03:10

I am trying to run jasperreports from within a web app (jboss/tomcat).


Using the IBM JDK 1.4.1, I got the error from the servlet container:

java.lang.NoClassDefFoundError: dori/jasper/engine/JRDataSource


Using the Sun JDK 1.4.2, I got:

java.lang.NoClassDefFoundError: dori/jasper/engine/JRReportFont


I have put jasperreport-0.5.0.jar in WEB-INF/lib in my war archive and check many times that the jasperreports-0.5.0.jar is indeed there.


Am I missing something really obvious? My web app uses other classes from WEB-INF/lib and it works fine.





By: Luis Alfredo Perez - luisperez

RE: NoClassDefFoundError with different JDK's

2003-09-29 08:55

I'm working with JasperReports' api v0.5.0. I've been trying to build a servlet which has to return a report to a client applet. I'm experiencing the same problem. I'm running Oracle's 9iAS v9.0.3 on a Linux SuSE SLES7.2 machine.


I tried to deploy the sample webapp that ships with the jasperreports' api but It doesn't worked either.


I included all the necesary classes in the instance's classpath. When that failed, I included the classes in the WEB-INF/lib directory of the webapp but that was useless, the problem persisted...


Does anyone of you know what we're doing wrong?







By: Firedragon - firedragon852

RE: NoClassDefFoundError with different JDK's

2003-09-29 23:54

I found the solution. This may help anybody who is trying to use jasper reports with an application server. There are 2 solutions:


1. First, place jasperreports-0.5.0.jar in WEB-INF/lib in your war archive. Place other associated jars that jasperreports uses in WEB-INF/lib if you need them (for instance, itext-0.96.jar if you are generating pdf's).


Let's assume that your servlet classes are in WEB-INF/classes/com/myCompany/servlets. If you have some utility classes that are accessing any jasperreports classes, you need to put them in the same package of your servlets. That is, if your servlets are in the package com.myCompany.servlets, have your utility classes in com.myCompany.servlets as well.


2. Put jasperreports-0.5.0.jar and friends in your application server lib directory. For jboss, it's in $JBOSS_HOME/server/default/lib (assuming your config is "default"). When the application is started, all the jasperreports classes will be loaded. This is not recommended if you need to deploy your application in different application servers.


P.S. The webapp demo that comes with jasperreports 0.5.0 will work in a standalone tomcat, because it's calling getRealPath() which always returns something. If you archive the webapp demo into a war archive and deploy it in an application server, getRealPath() will return NULL which I think is the error that you will get (NullPointerException).






By: Luis Alfredo Perez - luisperez

RE: NoClassDefFoundError with different JDK's

2003-09-30 07:21

Yeah, that was part of my solution but also the problem was related to the a "can't connect to X11 ..." error. In fact, the jasperreports api uploads classes from the AWT api. The AWT api needs a configured X11 on the system and a way to access it.

I was setting the DISPLAY environment variable on the console but, because I'm working with Oracle's 9iAS, the DISPLAY variable must be passed to the servlet engine explicitly. So, in the opmn/conf/opmn.xml you have to add an environment tag to your instance.

If someone out there is working with Oracle's 9iAS this will be very helpfull... for more information you can query Oracle's metalink repository, for those who has a login of course...

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