我正面临Spring 3 MVC + Tomcat 7堆栈并使用Eclipse来完成这项工作。在Eclipse(Luna)中,我安装了一个指向我的Tomcat安装的新服务器。为了使.war尽可能小,将很多lib嵌入到%TOMCAT_HOME%/shared
中。我在Eclipse中创建了一个新的Tomcat服务器指向%TOMCAT_HOME%
,我想用它来运行我的maven + Spring 3 webapp。当我以Run on Server
运行我的webapp时,我得到了这个
8-apr-2015 8.29.04 org.apache.catalina.startup.ClassLoaderFactory validateFile
AVVERTENZA: Problem with directory [/home/francesco/Scrivania/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/shared], exists: [false], isDirectory: [false], canRead: [false]
8-apr-2015 8.29.04 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home/francesco/jdk1.6.0_20/jre/lib/amd64/server:/home/francesco/jdk1.6.0_20/jre/lib/amd64:/home/francesco/jdk1.6.0_20/jre/../lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
8-apr-2015 8.29.04 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVVERTENZA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:estra-agenzie-webapp' did not find a matching property.
8-apr-2015 8.29.05 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
8-apr-2015 8.29.05 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
8-apr-2015 8.29.05 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 423 ms
8-apr-2015 8.29.05 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
8-apr-2015 8.29.05 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
8-apr-2015 8.29.05 org.apache.tomcat.websocket.server.WsSci onStartup
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocketJARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
8-apr-2015 8.29.05 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/francesco/Scrivania/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/estra-agenzie-webapp/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Error configuring application listener of class org.springframework.security.web.session.HttpSessionEventPublisher
java.lang.ClassNotFoundException: org.springframework.security.web.session.HttpSessionEventPublisher
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Skipped installing application listeners due to previous error(s)
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
8-apr-2015 8.29.05 org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/estra-agenzie-webapp] startup failed due to previous errors
8-apr-2015 8.29.05 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
8-apr-2015 8.29.05 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
8-apr-2015 8.29.05 org.apache.catalina.startup.Catalina start
INFO: Server startup in 870 ms
当我直接在%TOMCAT_HOME%/webapp
下部署webapp时,它运行正常。看起来我的运行配置无法看到%TOMCAT_HOME%/shared
目录。我还将此参数添加为运行配置VM参数:
-Dshared.loader="/my-tomcat-home/shared"
或将%TOMCAT_HOME%/shared
中的.jars直接添加到运行配置类路径中,但问题仍然存在。