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

getting a new jar to work with api


jgh

Recommended Posts

Hi,

I am trying to get a jar to work that has been compiled and distributed to the filesystem for our JasperReports Server, and am receiving the following errors. I have added it to the classpath, for tomcat startup, and this doesn't seem to work. The only way we are able to get this to work is to move the jar into a different directory, not loaded by the application server, and add it as a resource to JasperServer. Is there a way to do this more cleanly?

 

Thanks!

jgh 

 
---
 
The class "net.sf.jasperreports.engine.JRDefaultScriptlet" is, in
fact, in the classpath, included in file "/usr/local/tomcat5.5/webapps/jasperserver/WEB-INF/lib/jasperreports-4.5.0.2.jar"
 
With the scriptlet class file in
"/usr/local/tomcat5.5/common/lib/ee_jr.jar", the scriptlet would not
work, whether or not it was included through the web interface. When I
removed the "ee_jr.jar" file from "/usr/local/tomcat5.5/common/lib/",
then the scriptlet did finally work when included through the web
interface.
 
---
 
Contents of jar file:
     0 Sat Mar 03 00:57:52 PST 2012 META-INF/
   102 Sat Mar 03 00:57:50 PST 2012 META-INF/MANIFEST.MF
     0 Sat Mar 03 00:57:50 PST 2012 com/
     0 Sat Mar 03 00:57:50 PST 2012 com/ee/
     0 Sat Mar 03 00:57:50 PST 2012 com/ee/jasperreports/
  4393 Sat Mar 03 00:57:50 PST 2012 com/ee/jasperreports/JRScriptlet.class
Code:
org.springframework.web.util.NestedServletException: Handlerprocessing failed; nested exception is java.lang.NoClassDefFoundError:net/sf/jasperreports/engine/JRDefaultScriptlet...Caused by: java.lang.NoClassDefFoundError:net/sf/jasperreports/engine/JRDefaultScriptlet...Caused by: java.lang.ClassNotFoundException:net.sf.jasperreports.engine.JRDefaultScriptlet
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

 It sounds like a classloader issue. If the scriptlet jar file is in  /usr/local/tomcat5.5/common/lib, classes in the jar file are loaded by a server classloader. The server classloader is the parent of the web app classloader. Once the server classloader loads a class in the net.sf.jasperreports.engine package from a jar file, the child classloader will load classes in net.sf.jasperreports.engine by delegating to the parent classloader; the child classloader will not try to load the class from other jars. So you get ClassNotFoundExceptions even though the jar file is in the classpath.

 Does it work if you move ee_jr.jar to /usr/local/tomcat5.5/webapps/jasperserver/WEB-INF/lib? 

Link to comment
Share on other sites

mwoinoskibt
Wrote:

 It sounds like a classloader issue. If the scriptlet jar file is in  /usr/local/tomcat5.5/common/lib, classes in the jar file are loaded by a server classloader. The server classloader is the parent of the web app classloader. Once the server classloader loads a class in the net.sf.jasperreports.engine package from a jar file, the child classloader will load classes in net.sf.jasperreports.engine by delegating to the parent classloader; the child classloader will not try to load the class from other jars. So you get ClassNotFoundExceptions even though the jar file is in the classpath.

 Does it work if you move ee_jr.jar to /usr/local/tomcat5.5/webapps/jasperserver/WEB-INF/lib? 

 

Great explanation. This worked. Thank you so much!

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