What happens if you put the jar file(s) in %yourWebApp%/WEB-INF/lib? Tom Vekemans
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: jeudi 23 septembre 2004 14:25 To: Tomcat Users List Subject: Classloading, jar-files in shared/lib works only when webapp is placed in $CATALINA_HOME/webapps (tomcat 5.0.28) I tested a very simple servlet application and found that classes in jar-files that are placed in $CATALINA_HOME/shared/lib works just fine when the application is placed under the $CATALINA_HOME/webapps directory. However, if the application is placed elsewhere on the disc, let us say in d:/myTomcat5Test/exploded and then a context configuration file is is created, let us say $CATALINA_HOME/conf/Catalina/localhost/myTomcat5Test.xml and pointing the docBase to d:/myTomcat5Test/exploded, then the application will throw a ClassNotFoundException. This is what the context snippet looks like ************************* <Context path="/myTomcat5Test" docBase="d:/myTomcat5Test/exploded" debug="0" privileged="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_myTomcat5Test_log." suffix=".txt" timestamp="true"/> </Context> When testing the same application under Tomcat4, everyting works just fine. Any ideas why folks ? Regards Erik On 2004-09-17 [EMAIL PROTECTED] wrote: >Hello > >Sorry to drag this issue on but, I still don't get Tomcat 5 to recognize classes in jar files located in $CATALINA_HOME/shared/lib > >I tried my orginal application (which was running fine under Tomcat 4.1.x, both on Windows and Linux) >with Tomcat 5.0.28 and then with 5.0.16, both under Windows and Linux, but the problem with the ClassNotFoundEception still occurred. > >Then I decided to reduce as many potential problem areas as possible, by writing a new very simple application consisting of only one html page and one servlet, and only one external jar-file. (My original application was quite large with many jar dependencies) > >So I started up my IDE, created the new application, created the servlet, deployed in tomcat 4.1.x and, placed the jar-file in /shared/lib and of course it works. >Then I deployed under Tomcat 5.0.28, but no, it does not work. After moving the jarfile to /common/lib it works though. > >This really puzzels me. > >What can I do to get to the bottom with this ? >Is there any specific configuration that I could have missed ? >Any other test cases I should perform ? >Should I send my code to someone for inspection ? > > >Any help is appreciated > > >On 2004-09-01 Shapira Yoav wrote: > > >>Hi, >>Oh yeah, that reminds me, we might have a bug still present with >>classloading from shared/lib in 5.0.x. Try a much earlier version, e.g. >>5.0.16, and let us know if that works. >> >>Yoav Shapira >>Millennium Research Informatics >> >> >>>-----Original Message----- >>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >>>Sent: Wednesday, September 01, 2004 3:58 PM >>>To: [EMAIL PROTECTED] >>>Subject: What is the difference in classloading between tomcat 4.1.x >>and >>>5.0.x >>> >>> >>>In a web application running under Tomcat, I have defined a filter in >>the >>>web.xml file. The filter is pointing to a class that is packed in a >>jar- >>>file, and the jar-file is kept in the $CATALINA_HOME/shared/lib >>directory. >>> >>>In Tomcat 4.1.x the application is working without any problems. When >>>trying to run the same application under Tomcat 5.0.28 a >>>java.lang.ClassNotFoundException is thrown. >>> >>>If the jar-file is placed in $CATALINA_HOME/common/lib, then the class >>is >>>found and the application runs without problem. >>> >>>The same issue appears when using Listeners in the web.xml file. >>> >>>I have also tried the same setup with 5.0.27 which leads to the same >>>result. >>> >>>What is it that has changed between 4.1x and 5.0.x, in regards to >>>classloading, in order to cause this problem ? >>> >>>Any help in understanding this problem is appreciated. >>>Regards >>>Erik >>> >>> >>> ********** stacktrace >>>****************************************************** >>>2004-09-01 17:35:07 >>>NamingContextListener[/Catalina/localhost/webdialInstance]: Resource >>>parameters for UserTransaction = null >>>2004-09-01 17:35:07 StandardContext[/webdialInstance]Exception starting >>>filter Compress >>>java.lang.ClassNotFoundException: >>>se.erit.web.servlet.filters.gzip.GZIPFilter >>> at >>>org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa de >>r.ja >>>va:1340) >>> at >>>org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa de >>r.ja >>>va:1189) >>> at >>>org.apache.catalina.core.ApplicationFilterConfig.getFilter(Applicatio nF >>ilte >>>rConfig.java:211) >>> at >>>org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(Applica ti >>onFi >>>lterConfig.java:308) >>> at >>>org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFi lt >>erCo >>>nfig.java:79) >>> at >>>org.apache.catalina.core.StandardContext.filterStart(StandardContext. ja >>va:3 >>>698) >>> at >>>org.apache.catalina.core.StandardContext.start(StandardContext.java:4 34 >>9) >>> at >>>org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase .j >>ava: >>>823) >>> at >>>org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java: 12 >>1) >>> at >>>org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(Contain er >>Base >>>.java:143) >>> at java.security.AccessController.doPrivileged(Native Method) >>> at >>>org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80 5) >>> at >>>org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) >>> at >>>org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDe pl >>oyer >>>.java:903) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. ja >>va:3 >>>9) >>> at >>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces so >>rImp >>>l.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:324) >>> at >>>org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.jav a: >>216) >>> at >>org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256) >>> at org.apache.commons.digester.Rule.end(Rule.java:276) >>> at >>>org.apache.commons.digester.Digester.endElement(Digester.java:1058) >>> at >>>org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester .j >>ava: >>>76) >>> at >>org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown >>>Source) >>> at >>>org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement( Un >>know >>>n Source) >>> at >>>org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent Di >>spat >>>cher.dispatch(Unknown Source) >>> at >>>org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un kn >>own >>>Source) >>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown >>Source) >>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown >>Source) >>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown >>Source) >>> at >>org.apache.commons.digester.Digester.parse(Digester.java:1567) >>> at >>>org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep lo >>yer. >>>java:488) >>> at >>>org.apache.catalina.core.StandardHost.install(StandardHost.java:863) >>> at >>>org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j av >>a:48 >>>3) >>> at >>>org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427 ) >>> at >>org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) >>> at >>>org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java :3 >>49) >>> at >>>org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl eS >>uppo >>>rt.java:119) >>> at >>>org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) >>> at >>org.apache.catalina.core.StandardHost.start(StandardHost.java:789) >>> at >>>org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) >>> at >>>org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478 ) >>> at >>>org.apache.catalina.core.StandardService.start(StandardService.java:4 80 >>) >>> at >>>org.apache.catalina.core.StandardServer.start(StandardServer.java:231 3) >>> at org.apache.catalina.startup.Catalina.start(Catalina.java:556) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. ja >>va:3 >>>9) >>> at >>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces so >>rImp >>>l.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:324) >>> at >>org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) >>> at >>org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) >>> >>>*************** end of trace >>>*************************************************** >>> >>> >>> >>> >>>Erik Rosengren >>>ERIT Consulting AB >>>+46-70-7183333 >>>mailto:[EMAIL PROTECTED] >>>http://www.erit.se >>> >>> >>> >>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >>This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
