Re: Having trouble with common.loader
Thank you all for your help. I figured out what the problem was. I accidentally made logging.properties and catalina.properties owned by root:root with 640 permissions. Changed to root:tomcat, and everything worked right away.
Re: Having trouble with common.loader
On Thu, Aug 22, 2013 at 2:51 PM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2013/8/22 D C dc12...@gmail.com: On Thu, Aug 22, 2013 at 11:48 AM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2013/8/22 Daniel Mikusa dmik...@gopivotal.com: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan 1. +1. Adding webapp libraries to the common classloader (by placing them into ${catalina.base}/lib or by modifying the definition of common.loader) is a bad idea. (as documented and as discussed many times on this mailing list) IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Interesting. I just tried this out, but I'm not having luck. We load the context of the app from $catalina_home/conf/Catalina/localhost/myApp.xml I tried adding the Loader to my context so it looks like this. Am I doing something wrong. ?xml version='1.0' encoding='utf-8'? Context Loader className=org.apache.catalina.loader.VirtualWebappLoader virtualClasspath=/web/lib;/web/lib/*.jar/ Looks OK, if those paths are correct. You can enable debug logging for that class and it will list whatever jars it finds. Is the following shell command able to list your jar files? ls /web/lib/ # su - tomcat -s /bin/bash -bash-4.1$ ls /web/lib/ adcenter_live_base-20070831.jar c3p0-0.9.1.jar commons-httpclient-3.0.1.jar jakarta-oro-2.0.8.jar spring-beans-3.1.0.RELEASE.jar wsdl4j-1.5.1.jar amqp-client-2.8.0.jarcommons-beanutils-1.7.0.jar commons-lang-2.4.jar jaxrpc-api-1.1.jar spring-context-3.1.0.RELEASE.jar xml-apis-1.0.b2.jar aopalliance-1.0.jar commons-codec-1.3.jar commons-logging-1.0.4.jar log4j-1.2.16.jar spring-core-3.1.0.RELEASE.jar Ask-3.0.jar commons-collections-2.1.jar commons-math3-3.0.jar memcached-client-20120227.jar spring-expression-3.1.0.RELEASE.jar axis-1.3.jar commons-dbcp-1.2.2.jar commons-pool-1.3.jar mysql-connector-java-5.1.10.jar spring-jdbc-3.1.0.RELEASE.jar axis-jaxrpc-1.3.jar commons-digester-1.6.jar commons-validator-1.3.1.jar spring-aop-3.1.0.RELEASE.jar spring-tx-3.1.0.RELEASE.jar axis-saaj-1.3.jarcommons-discovery-0.2.jar geoApi-20080422.jar spring-asm-3.1.0.RELEASE.jar spring-web-3.1.0.RELEASE.jar /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 You are using 7.0.40, 7.0.42, or some ancient version? 7.0.40 and 7.0.42 For the sake of testing, i'll stick to 7.0.42. Do you know how configure Tomcat with separate $CATALINA_BASE and $CATALINA_HOME? I didn't specifically do that. This is what i did: server.xml: Host name=localhost appBase=/web/webapps logging.properties: replaced all instances of ${catalina.base}/logs with /web/logs. - this actually didn't work. but im not dwelling on it right now. Do they have the same value for you, or different ones? (As printed by catalina.sh just before Tomcat starts). Using CATALINA_BASE: /tomcat Using CATALINA_HOME: /tomcat Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On Aug 21, 2013, at 5:09 PM, D C dc12...@gmail.com wrote: I added verbose, it does not appear to attempt to load anything from /web/lib/ Ok. Where do you see it loading classes from? /WEB-INF/lib/*.jar? Do you see any classes listed that you would expect to be loaded from /web/lib? Where are they being loaded from? for permissions i verified that i could read the files as the tomcat user. Good Thanks, Dan On Wed, Aug 21, 2013 at 5:01 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? You can certainly add entries to common.loader and yours looks OK. Assuming the paths exist and permissions on those paths are correct, I'd suggest adding the -verbose JVM argument to your bin/setenv.sh file. This will show you the location of classes that are being loaded. Perhaps it is loading classes from those locations and there is some other reason you are getting the ClassNotFoundException. Dan Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at
Re: Having trouble with common.loader
[tomcat@test05 logs]# grep from file catalina.out | sed 's/.*from file//g' | sed 's/\/lib\/.*/\/lib/g' | sort -u :/opt/apache-tomcat-7.0.40/bin/bootstrap.jar] :/opt/apache-tomcat-7.0.40/bin/tomcat-juli.jar] :/opt/apache-tomcat-7.0.40/lib :/opt/jdk1.7.0.21/jre/lib :/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] :/web/webapps/myApp/WEB-INF/lib Thanks, Dan On Thu, Aug 22, 2013 at 6:47 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 5:09 PM, D C dc12...@gmail.com wrote: I added verbose, it does not appear to attempt to load anything from /web/lib/ Ok. Where do you see it loading classes from? /WEB-INF/lib/*.jar? Do you see any classes listed that you would expect to be loaded from /web/lib? Where are they being loaded from? for permissions i verified that i could read the files as the tomcat user. Good Thanks, Dan On Wed, Aug 21, 2013 at 5:01 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? You can certainly add entries to common.loader and yours looks OK. Assuming the paths exist and permissions on those paths are correct, I'd suggest adding the -verbose JVM argument to your bin/setenv.sh file. This will show you the location of classes that are being loaded. Perhaps it is loading classes from those locations and there is some other reason you are getting the ClassNotFoundException. Dan Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
Re: Having trouble with common.loader
On Aug 22, 2013, at 8:38 AM, D C dc12...@gmail.com wrote: [tomcat@test05 logs]# grep from file catalina.out | sed 's/.*from file//g' | sed 's/\/lib\/.*/\/lib/g' | sort -u :/opt/apache-tomcat-7.0.40/bin/bootstrap.jar] :/opt/apache-tomcat-7.0.40/bin/tomcat-juli.jar] :/opt/apache-tomcat-7.0.40/lib :/opt/jdk1.7.0.21/jre/lib :/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] :/web/webapps/myApp/WEB-INF/lib Can you show the unaltered output? If you want to filter out stuff to make it smaller, filter out any classes that were loaded from the JDK. Dan Thanks, Dan On Thu, Aug 22, 2013 at 6:47 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 5:09 PM, D C dc12...@gmail.com wrote: I added verbose, it does not appear to attempt to load anything from /web/lib/ Ok. Where do you see it loading classes from? /WEB-INF/lib/*.jar? Do you see any classes listed that you would expect to be loaded from /web/lib? Where are they being loaded from? for permissions i verified that i could read the files as the tomcat user. Good Thanks, Dan On Wed, Aug 21, 2013 at 5:01 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? You can certainly add entries to common.loader and yours looks OK. Assuming the paths exist and permissions on those paths are correct, I'd suggest adding the -verbose JVM argument to your bin/setenv.sh file. This will show you the location of classes that are being loaded. Perhaps it is loading classes from those locations and there is some other reason you are getting the ClassNotFoundException. Dan Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at
Re: Having trouble with common.loader
On Aug 22, 2013, at 9:21 AM, D C dc12...@gmail.com wrote: Ok, here goes. grep -v '/opt/jdk' snip Removing some of the fluff. Aug 21, 2013 5:08:03 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.40/conf/Catalina/localhost/myApp.xml Ok, myApp is deployed here... [Loaded org.springframework.web.SpringServletContainerInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.WebApplicationInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] We can see that some of the Spring classes are being loaded from WEB-INF/lib. Were you expecting this? [Loaded org.springframework.web.context.ContextLoader from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.context.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] More Spring classes loaded from WEB-INF/ilb. Again, were you expecting this? [Loaded com.myco.management.spring_utils.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] Looks like one of your custom classes is being loaded. No big deal. Aug 21, 2013 5:08:07 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: App start fails... Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Missing class is org.springframework.core.io.Resource. Where is your spring-core-3.1.0.RELEASE.jar file? Looking further... at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) The stack trace seems to indicate that this error occurred while the container was scanning for annotations. Is your application making use of Spring's WebApplicationInitializer functionality? If not, you might want to disable it and see if the error goes away. Dan On Thu, Aug 22, 2013 at 8:58 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 22, 2013, at 8:38 AM, D C dc12...@gmail.com wrote: [tomcat@test05 logs]# grep from file catalina.out | sed 's/.*from file//g' | sed 's/\/lib\/.*/\/lib/g' | sort -u :/opt/apache-tomcat-7.0.40/bin/bootstrap.jar] :/opt/apache-tomcat-7.0.40/bin/tomcat-juli.jar] :/opt/apache-tomcat-7.0.40/lib :/opt/jdk1.7.0.21/jre/lib :/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] :/web/webapps/myApp/WEB-INF/lib Can you show the unaltered output? If you want to filter out stuff to make it smaller, filter out any classes that were loaded from the JDK. Dan Thanks, Dan On Thu, Aug 22, 2013 at 6:47 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 5:09 PM, D C dc12...@gmail.com wrote: I added verbose, it does not appear to attempt to load anything from /web/lib/ Ok. Where do you see it loading classes from? /WEB-INF/lib/*.jar? Do you see any classes listed that you would expect to be loaded from /web/lib? Where are they being loaded from? for permissions i verified that i could read the files as the tomcat user. Good Thanks, Dan On Wed, Aug 21, 2013 at 5:01 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed
Re: Having trouble with common.loader
On Thu, Aug 22, 2013 at 10:30 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 22, 2013, at 9:21 AM, D C dc12...@gmail.com wrote: Ok, here goes. grep -v '/opt/jdk' snip Removing some of the fluff. Aug 21, 2013 5:08:03 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.40/conf/Catalina/localhost/myApp.xml Ok, myApp is deployed here... So far working as expected. [Loaded org.springframework.web.SpringServletContainerInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.WebApplicationInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] We can see that some of the Spring classes are being loaded from WEB-INF/lib. Were you expecting this? This is an example of something our developers will need to clean up before we release... But yes it was expected. [Loaded org.springframework.web.context.ContextLoader from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.context.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] More Spring classes loaded from WEB-INF/ilb. Again, were you expecting this? Yup. [Loaded com.myco.management.spring_utils.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] Looks like one of your custom classes is being loaded. No big deal. Aug 21, 2013 5:08:07 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: App start fails... Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Missing class is org.springframework.core.io.Resource. Where is your spring-core-3.1.0.RELEASE.jar file? /web/lib/spring-core-3.1.0.RELEASE.jar Looking further... at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) The stack trace seems to indicate that this error occurred while the container was scanning for annotations. Is your application making use of Spring's WebApplicationInitializer functionality? If not, you might want to disable it and see if the error goes away. Sorry I don't know. We just tried adding every jar file in /web/lib/ to the classpath and that seemed to work out, so this brings me back to whats wrong with common.loader? common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/web/lib,/web/lib/*.jar Dan On Thu, Aug 22, 2013 at 8:58 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 22, 2013, at 8:38 AM, D C dc12...@gmail.com wrote: [tomcat@test05 logs]# grep from file catalina.out | sed 's/.*from file//g' | sed 's/\/lib\/.*/\/lib/g' | sort -u :/opt/apache-tomcat-7.0.40/bin/bootstrap.jar] :/opt/apache-tomcat-7.0.40/bin/tomcat-juli.jar] :/opt/apache-tomcat-7.0.40/lib :/opt/jdk1.7.0.21/jre/lib :/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] :/web/webapps/myApp/WEB-INF/lib Can you show the unaltered output? If you want to filter out stuff to make it smaller, filter out any classes that were loaded from the JDK. Dan Thanks, Dan On Thu, Aug 22, 2013 at 6:47 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 5:09 PM, D C dc12...@gmail.com wrote: I added verbose, it does not appear to attempt to load anything from /web/lib/ Ok. Where do you see it loading classes from? /WEB-INF/lib/*.jar? Do you see any classes listed that you would expect to be loaded from /web/lib? Where are they being loaded from? for permissions i verified that i
Re: Having trouble with common.loader
2013/8/22 Daniel Mikusa dmik...@gopivotal.com: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan 1. +1. Adding webapp libraries to the common classloader (by placing them into ${catalina.base}/lib or by modifying the definition of common.loader) is a bad idea. (as documented and as discussed many times on this mailing list) IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation 2. Top-posting is bad, per rules of this mailing list, http://tomcat.apache.org/lists.html#tomcat-users - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On Aug 22, 2013, at 11:31 AM, D C dc12...@gmail.com wrote: On Thu, Aug 22, 2013 at 10:30 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 22, 2013, at 9:21 AM, D C dc12...@gmail.com wrote: Ok, here goes. grep -v '/opt/jdk' snip Removing some of the fluff. Aug 21, 2013 5:08:03 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.40/conf/Catalina/localhost/myApp.xml Ok, myApp is deployed here... So far working as expected. [Loaded org.springframework.web.SpringServletContainerInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.WebApplicationInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] We can see that some of the Spring classes are being loaded from WEB-INF/lib. Were you expecting this? This is an example of something our developers will need to clean up before we release... But yes it was expected. [Loaded org.springframework.web.context.ContextLoader from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.context.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] More Spring classes loaded from WEB-INF/ilb. Again, were you expecting this? Yup. [Loaded com.myco.management.spring_utils.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] Looks like one of your custom classes is being loaded. No big deal. Aug 21, 2013 5:08:07 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: App start fails... Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Missing class is org.springframework.core.io.Resource. Where is your spring-core-3.1.0.RELEASE.jar file? /web/lib/spring-core-3.1.0.RELEASE.jar Looking further... at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) The stack trace seems to indicate that this error occurred while the container was scanning for annotations. Is your application making use of Spring's WebApplicationInitializer functionality? If not, you might want to disable it and see if the error goes away. Sorry I don't know. Try disabling it and see what happens. Edit conf/catalina.properties and set org.apache.catalina.startup.ContextConfig.jarsToSkip to spring-*.jar. That should instruct Tomcat to skip processing the Spring jar files for Servlet 3.0 pluggability features like web fragments, annotations SCIs. We just tried adding every jar file in /web/lib/ to the class path What do you mean by this? How did you add them to the class path? Did you copy them into WEB-INF/lib? and that seemed to work out, so this brings me back to whats wrong with common.loader? common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/web/lib,/web/lib/*.jar Syntax looks fine to me. As myself and others mentioned originally, sharing classes with the common class loader causes lots of headaches. I would say that you've found one here. A suggestion for debugging further, remove the -verbose JVM argument and set the log level for org.apache.catalina.loader.WebappClassLoader to FINE. The WebappClassLoader has some debugging information that it should write to the logs. This could give us further clues as to what is happening. Dan Dan On Thu, Aug 22, 2013 at 8:58 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 22, 2013, at 8:38 AM, D C dc12...@gmail.com wrote: [tomcat@test05 logs]# grep from file catalina.out | sed 's/.*from file//g' |
Re: Having trouble with common.loader
On Thu, Aug 22, 2013 at 11:57 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 22, 2013, at 11:31 AM, D C dc12...@gmail.com wrote: On Thu, Aug 22, 2013 at 10:30 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 22, 2013, at 9:21 AM, D C dc12...@gmail.com wrote: Ok, here goes. grep -v '/opt/jdk' snip Removing some of the fluff. Aug 21, 2013 5:08:03 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.40/conf/Catalina/localhost/myApp.xml Ok, myApp is deployed here... So far working as expected. [Loaded org.springframework.web.SpringServletContainerInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.WebApplicationInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] We can see that some of the Spring classes are being loaded from WEB-INF/lib. Were you expecting this? This is an example of something our developers will need to clean up before we release... But yes it was expected. [Loaded org.springframework.web.context.ContextLoader from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.context.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] More Spring classes loaded from WEB-INF/ilb. Again, were you expecting this? Yup. [Loaded com.myco.management.spring_utils.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] Looks like one of your custom classes is being loaded. No big deal. Aug 21, 2013 5:08:07 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: App start fails... Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Missing class is org.springframework.core.io.Resource. Where is your spring-core-3.1.0.RELEASE.jar file? /web/lib/spring-core-3.1.0.RELEASE.jar Looking further... at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) The stack trace seems to indicate that this error occurred while the container was scanning for annotations. Is your application making use of Spring's WebApplicationInitializer functionality? If not, you might want to disable it and see if the error goes away. Sorry I don't know. Try disabling it and see what happens. Edit conf/catalina.properties and set org.apache.catalina.startup.ContextConfig.jarsToSkip to spring-*.jar. That should instruct Tomcat to skip processing the Spring jar files for Servlet 3.0 pluggability features like web fragments, annotations SCIs. We just tried adding every jar file in /web/lib/ to the class path What do you mean by this? How did you add them to the class path? Did you copy them into WEB-INF/lib? No the environment variable in setenv.sh CLASSPATH=every jar and that seemed to work out, so this brings me back to whats wrong with common.loader? common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/web/lib,/web/lib/*.jar Syntax looks fine to me. As myself and others mentioned originally, sharing classes with the common class loader causes lots of headaches. I would say that you've found one here. A suggestion for debugging further, remove the -verbose JVM argument and set the log level for org.apache.catalina.loader.WebappClassLoader to FINE. The WebappClassLoader has some debugging information that it should write to the logs. This could give us further clues as to what is
Re: Having trouble with common.loader
On Thu, Aug 22, 2013 at 11:48 AM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2013/8/22 Daniel Mikusa dmik...@gopivotal.com: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan 1. +1. Adding webapp libraries to the common classloader (by placing them into ${catalina.base}/lib or by modifying the definition of common.loader) is a bad idea. (as documented and as discussed many times on this mailing list) IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Interesting. I just tried this out, but I'm not having luck. We load the context of the app from $catalina_home/conf/Catalina/localhost/myApp.xml I tried adding the Loader to my context so it looks like this. Am I doing something wrong. ?xml version='1.0' encoding='utf-8'? Context Loader className=org.apache.catalina.loader.VirtualWebappLoader virtualClasspath=/web/lib;/web/lib/*.jar/ Resource factory=org.apache.tomcat.jdbc.pool.DataSourceFactory ... 2. Top-posting is bad, per rules of this mailing list, http://tomcat.apache.org/lists.html#tomcat-users - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On Aug 22, 2013, at 12:32 PM, D C dc12...@gmail.com wrote: On Thu, Aug 22, 2013 at 11:57 AM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 22, 2013, at 11:31 AM, D C dc12...@gmail.com wrote: On Thu, Aug 22, 2013 at 10:30 AM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 22, 2013, at 9:21 AM, D C dc12...@gmail.com wrote: Ok, here goes. grep -v '/opt/jdk' snip Removing some of the fluff. Aug 21, 2013 5:08:03 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.40/conf/Catalina/localhost/myApp.xml Ok, myApp is deployed here... So far working as expected. [Loaded org.springframework.web.SpringServletContainerInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.WebApplicationInitializer from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] We can see that some of the Spring classes are being loaded from WEB-INF/lib. Were you expecting this? This is an example of something our developers will need to clean up before we release... But yes it was expected. [Loaded org.springframework.web.context.ContextLoader from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] [Loaded org.springframework.web.context.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/lib/spring-web-3.1.0.RELEASE.jar] More Spring classes loaded from WEB-INF/ilb. Again, were you expecting this? Yup. [Loaded com.myco.management.spring_utils.ContextLoaderListener from file:/web/webapps/myApp/WEB-INF/classes/com/myco/management/spring_utils/ContextLoaderListener.class] Looks like one of your custom classes is being loaded. No big deal. Aug 21, 2013 5:08:07 PM org.apache.catalina.core.ContainerBase addChildInternal SEVERE: ContainerBase.addChild: start: App start fails... Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Missing class is org.springframework.core.io.Resource. Where is your spring-core-3.1.0.RELEASE.jar file? /web/lib/spring-core-3.1.0.RELEASE.jar Looking further... at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) The stack trace seems to indicate that this error occurred while the container was scanning for annotations. Is your application making use of Spring's WebApplicationInitializer functionality? If not, you might want to disable it and see if the error goes away. Sorry I don't know. Try disabling it and see what happens. Edit conf/catalina.properties and set org.apache.catalina.startup.ContextConfig.jarsToSkip to spring-*.jar. That should instruct Tomcat to skip processing the Spring jar files for Servlet 3.0 pluggability features like web fragments, annotations SCIs. We just tried adding every jar file in /web/lib/ to the class path What do you mean by this? How did you add them to the class path? Did you copy them into WEB-INF/lib? No the environment variable in setenv.sh CLASSPATH=every jar I'm surprise that actually worked. The catalina script will typically ignore attempts to set CLASSPATH directly. I would really, really suggest you don't do this. and that seemed to work out, so this brings me back to whats wrong with common.loader? common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/web/lib,/web/lib/*.jar Syntax looks fine to me. As myself and others mentioned originally, sharing classes with the common class loader causes lots of headaches. I would say that you've found one here. A suggestion for debugging further, remove the -verbose JVM argument and set the log level for
Re: Having trouble with common.loader
2013/8/22 D C dc12...@gmail.com: On Thu, Aug 22, 2013 at 11:48 AM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2013/8/22 Daniel Mikusa dmik...@gopivotal.com: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan 1. +1. Adding webapp libraries to the common classloader (by placing them into ${catalina.base}/lib or by modifying the definition of common.loader) is a bad idea. (as documented and as discussed many times on this mailing list) IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Interesting. I just tried this out, but I'm not having luck. We load the context of the app from $catalina_home/conf/Catalina/localhost/myApp.xml I tried adding the Loader to my context so it looks like this. Am I doing something wrong. ?xml version='1.0' encoding='utf-8'? Context Loader className=org.apache.catalina.loader.VirtualWebappLoader virtualClasspath=/web/lib;/web/lib/*.jar/ Looks OK, if those paths are correct. You can enable debug logging for that class and it will list whatever jars it finds. Is the following shell command able to list your jar files? ls /web/lib/ /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 You are using 7.0.40, 7.0.42, or some ancient version? Do you know how configure Tomcat with separate $CATALINA_BASE and $CATALINA_HOME? Do they have the same value for you, or different ones? (As printed by catalina.sh just before Tomcat starts). Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
Am 2013-08-22 17:48, schrieb Konstantin Kolinko: 2013/8/22 Daniel Mikusa dmik...@gopivotal.com: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan 1. +1. Adding webapp libraries to the common classloader (by placing them into ${catalina.base}/lib or by modifying the definition of common.loader) is a bad idea. (as documented and as discussed many times on this mailing list) IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Very decent tip for this loader. Does the Javadoc warning This is not meant to be used for production. Its meant to ease development with IDE's without the need for fully republishing jars in WEB-INF/lib still count? Michael - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Having trouble with common.loader
From: Michael-O [mailto:1983-01...@gmx.net] Subject: Re: Having trouble with common.loader IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Very decent tip for this loader. Does the Javadoc warning This is not meant to be used for production. Its meant to ease development with IDE's without the need for fully republishing jars in WEB-INF/lib still count? No. That statement was removed from the doc: http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html and the Javadoc some time ago. Use the current information. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
Am 2013-08-22 21:40, schrieb Caldarale, Charles R: From: Michael-O [mailto:1983-01...@gmx.net] Subject: Re: Having trouble with common.loader IF you want to decouple libraries from your war, add them to your webapp's classpath, by configuring a VirtualWebappLoader , http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation Very decent tip for this loader. Does the Javadoc warning This is not meant to be used for production. Its meant to ease development with IDE's without the need for fully republishing jars in WEB-INF/lib still count? No. That statement was removed from the doc: http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html and the Javadoc some time ago. Use the current information. True, it's gone for Tomcat 7. One (I) should file a ticket for that. Thanks, Michael - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Having trouble with common.loader
Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Thanks, Dan
Re: Having trouble with common.loader
Basically you're trying to defeat the way the system is designed to work. Don't do that... On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Thanks, Dan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Thanks, Dan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On 8/21/2013 12:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? Thanks, Dan First of all, don't do this. Seriously, there are really no good reasons to do this and many, many reasons not to. Now, let's look at where you put your jars: You said you put them in /web/lib - where is /web/lib located? In the above catalina.properties line, you added: /web/lib/*.jar This is an absolute path, where /web is at the root of your file system. I doubt you a) meant to put the JARs there, and b) have read permission on that directory should it even exist. You have three options for describing the directory location: ${property.name}/directory/. . . . ./*.jar where property.name is either catalina.home or catalina.base. some-other-directory/. . . ./*.jar ../some-other-directory/. . . ./*.jar where the location is relative to catalina.base ($CATALINA_BASE). /some-absolute-directory/path/*.jar which just as it says, is an absolute directory path. There may be other property.name(s) exposed - read the documentation. Can you explain your use case for doing this? This will make a mess of builds, and who knows what will happen if a developer uses a different version of a library in a web application. a) will it fail because the library operation is different? b) will you get spurious class not found exceptions? c) will the developer remember to leave some JARs out, but include ones that you left out? Inquiring minds really don't want to think about the above mess. I know system administrators don't. . . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
On 8/21/2013 4:27 PM, Daniel Mikusa wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. And even the JDBC drivers only if Tomcat is handling your db connection pooling. If your app does that, then keep them in WEB-INF/lib as well. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Thanks, Dan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Having trouble with common.loader
So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
Re: Having trouble with common.loader
On Aug 21, 2013, at 4:33 PM, David kerber dcker...@verizon.net wrote: On 8/21/2013 4:27 PM, Daniel Mikusa wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. And even the JDBC drivers only if Tomcat is handling your db connection pooling. If your app does that, then keep them in WEB-INF/lib as well. Personally, I like to keep my drivers in $CATALINA_BASE/lib regardless of how they are being used. It's been my experience that some drivers don't behave correctly when hot deploying / undeploying apps. Keeping the driver in $CATALINA_BASE/lib works around this problem. That is just my preference though, because I've been hit by this in the past. Dan Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.io.Resource at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 25 more Thanks, Dan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail:
Re: Having trouble with common.loader
On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? You can certainly add entries to common.loader and yours looks OK. Assuming the paths exist and permissions on those paths are correct, I'd suggest adding the -verbose JVM argument to your bin/setenv.sh file. This will show you the location of classes that are being loaded. Perhaps it is loading classes from those locations and there is some other reason you are getting the ClassNotFoundException. Dan Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) at
Re: Having trouble with common.loader
I added verbose, it does not appear to attempt to load anything from /web/lib/ for permissions i verified that i could read the files as the tomcat user. Thanks, Dan On Wed, Aug 21, 2013 at 5:01 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Aug 21, 2013, at 4:48 PM, D C dc12...@gmail.com wrote: So here is what I'm trying to achieve. 1. The tomcat install remains clean. I want to be able to change the tomcat installation without messing with the app. 2. We want our applications to be decoupled from the libraries which it needs. ( i understand the pains you are referring to.. this was a bit of debate, but this is what we want to do). 3. We want our engineering team to manage libs via RPM, not the developers. tomcat is installed like so via RPM. /opt/tomcat-6.0.35 /opt/tomcat-7.0.39 /opt/tomcat-7.0.40 /tomcat symlinks to which ever /opt/tomcat-7.0.40 Context entries go in /tomcat/conf/Catalina/localhost/myApp.xml /web/webapps - holds our webapps. This much works perfectly. /web/conf/myApp - holds our application configs. /web/lib - holds any libs that are not part of the base tomcat installation. This is managed by rpm. If unpack a war file, and it has contents inside WEB_INF/lib, we will consider that a broken build. Everything works, except that my libs are not loading.. I had thought that I could add /web/lib,/web/lib/*.jar to the common.loader. Am I mistaken by this? You can certainly add entries to common.loader and yours looks OK. Assuming the paths exist and permissions on those paths are correct, I'd suggest adding the -verbose JVM argument to your bin/setenv.sh file. This will show you the location of classes that are being loaded. Perhaps it is loading classes from those locations and there is some other reason you are getting the ClassNotFoundException. Dan Thanks, Dan On Wed, Aug 21, 2013 at 4:27 PM, Daniel Mikusa dmik...@gopivotal.com wrote: On Aug 21, 2013, at 4:09 PM, David kerber dcker...@verizon.net wrote: Basically you're trying to defeat the way the system is designed to work. Don't do that… +1 Don't do what you've described unless you have a very good reason. It will cause you many headaches. Keep all of your JAR files in WEB-INF/lib, with the exception of JDBC drivers. Put those in $CATALINA_BASE/lib. Dan On 8/21/2013 3:58 PM, D C wrote: Tomcat 7.0.40 CentOS 6.3 Java 1.7.0_21 I am trying to move all libraries out of my webapps directory, and into a common place. I have my libs that were bundled with tomcat in /tomcat/lib (the default), and my extra libs i want to keep in /web/lib. I've updated /tomcat/conf/catalina.properties to use the following: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,/web/lib,/web/lib/*.jar I have my database resource located in /tomcat/conf/Catalina/localhost/myApp.xml (probably not relevant) When I start tomcat, I get the errors listed below. However if I move /web/lib/* to webapps/myApp/WEB_INF/lib/ it works fine. What am I missing here? catalina.out snip. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1636) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at