Re: ClassNotDefError problems within JAR files under Tomcat 4.1.12
Nathan, I am developing an imaging servlet under Tomcat 4.1.12 using JAI 1.1.2. Every time I update my code to add new features, it will return with a NoClassDefFoundError until I restart Tomcat. At that point, it finds the 'missing' class and everything works as expected. I'm no expert on JAI, but I believe that it uses JNI and a native library to do some of it's dirty work. If that's the case, then you should make sure that the JAI JAR file and native library are loaded by a classloader outside (higher than) your webapp. There's documentation on the Tomcat site (and probably other servlet containers, too) that says that native libraries should only be loaded one time. IF they get loaded multiple times (as would happen if they were loaded by the webapp), strange behavior can result. Try putting jai.jar (or whatever) into TOMCAT_HOME/common/lib and jai.so (or whatever) in a convenient place where it can be found. (Sorry, dunno where that might be. Anyone else?) Hope that helps, -chris signature.asc Description: PGP signature signature.asc Description: OpenPGP digital signature
ClassNotDefError problems within JAR files under Tomcat 4.1.12
I am developing an imaging servlet under Tomcat 4.1.12 using JAI 1.1.2. Every time I update my code to add new features, it will return with a NoClassDefFoundError until I restart Tomcat. At that point, it finds the 'missing' class and everything works as expected. Only the superficial ImageIO classes are directly invoked (ImageReader, ImageWriter, ImageIO) - the NoClassDefFoundErrors are always for implementation specific classes (typically com.sun.media.*). I've verified that the files are in JAR files located under /WEB-INF/lib so they should be picked up by Tomcat on a reload. Are the JAR files not scanned for dependencies on a reload? I've never had this problem with classes that I create - I simply place them in /WEB-INF/classes/package specific path/ and they are picked up on a reload with having to restart the entire container. Here is the last error that I saw - this is typical of what I see when these errors occur java.lang.NoClassDefFoundError: com/sun/media/imageioimpl/plugins/jpeg2000/J2KReadState at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.readHeader(J2KImageReader.java:285) at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.getWidth(J2KImageReader.java:235) at edu.wisc.library.ltg.digitalCollections.JP2Image.(JP2Image.java:93) at edu.wisc.library.ltg.digitalCollections.ImageFactory.createImage(ImageFactory.java:73) at edu.wisc.library.ltg.digitalCollections.TestCollectionImpl.getResource(TestCollectionImpl.java:59) at edu.wisc.library.ltg.imageServlet.SimpleImageServlet.doGet(SimpleImageServlet.java:177) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533) at java.lang.Thread.run(Thread.java:534) -- Nathan Rogers Library Technology Group 312F Memorial Library 728 State Street - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassNotDefError problems within JAR files under Tomcat 4.1.12
I just noticed a slight (but important typo). Sorry for the reply to my own message. It should say and they are picked up on a reload without having to restart the entire container. rather than what it actually does say. Spellcheckers should be smart enough to know what I mean, even if what I said was legal English. :) Nathan Rogers wrote: I am developing an imaging servlet under Tomcat 4.1.12 using JAI 1.1.2. Every time I update my code to add new features, it will return with a NoClassDefFoundError until I restart Tomcat. At that point, it finds the 'missing' class and everything works as expected. Only the superficial ImageIO classes are directly invoked (ImageReader, ImageWriter, ImageIO) - the NoClassDefFoundErrors are always for implementation specific classes (typically com.sun.media.*). I've verified that the files are in JAR files located under /WEB-INF/lib so they should be picked up by Tomcat on a reload. Are the JAR files not scanned for dependencies on a reload? I've never had this problem with classes that I create - I simply place them in /WEB-INF/classes/package specific path/ and they are picked up on a reload with having to restart the entire container. Here is the last error that I saw - this is typical of what I see when these errors occur java.lang.NoClassDefFoundError: com/sun/media/imageioimpl/plugins/jpeg2000/J2KReadState at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.readHeader(J2KImageReader.java:285) at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.getWidth(J2KImageReader.java:235) at edu.wisc.library.ltg.digitalCollections.JP2Image.(JP2Image.java:93) at edu.wisc.library.ltg.digitalCollections.ImageFactory.createImage(ImageFactory.java:73) at edu.wisc.library.ltg.digitalCollections.TestCollectionImpl.getResource(TestCollectionImpl.java:59) at edu.wisc.library.ltg.imageServlet.SimpleImageServlet.doGet(SimpleImageServlet.java:177) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533) at java.lang.Thread.run(Thread.java:534) -- Nathan Rogers Library Technology Group 312F Memorial Library 728 State Street 261-1409 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional