2016-05-25 110 views
0

我的應用程序建立在Java 8,Spring 3.0.6上並運行在Tomcat 7上。Spring 3.0.6 with Tomcat 8

它一切正常。

但是,當我將Tomcat版本更新爲8時,我會看到下面的內容。

有誰知道Spring 3是否有在Tomcat 8上運行的任何問題?

[2016-05-25 11:21:40,307][INFO] - ContextLoader.log: Root WebApplicationContext: initialization started 
[2016-05-25 11:21:41,072][ERROR] - ContextLoader.log: Context initialization failed 
java.lang.NoClassDefFoundError: org/springframework/core/env/ConfigurableEnvironment 
    at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_72] 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_72] 
    at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_72] 
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[?:1.8.0_72] 
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104) ~[org.springframework.beans-3.0.6.RELEASE.jar:3.0.6.RELEASE] 
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:347) ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:280) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4813) [catalina.jar:8.0.35] 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5272) [catalina.jar:8.0.35] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [catalina.jar:8.0.35] 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.35] 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.35] 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) [catalina.jar:8.0.35] 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092) [catalina.jar:8.0.35] 
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834) [catalina.jar:8.0.35] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_72] 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_72] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_72] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_72] 
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72] 
Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.ConfigurableEnvironment 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) ~[catalina.jar:8.0.35] 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ~[catalina.jar:8.0.35] 
    ... 21 more 
+0

做一些春天的罐子在lib文件夾中你的tomcat 7? – Mark

回答

0

EnvironmentCapable類可從春季3.1開始。

請運行mvn:dependency tree命令以正確檢查所有依賴關係。

+0

它不是一個maven項目。有沒有其他方法可以找出答案?這也意味着我將不得不升級到3.1版本。我目前在3.0.6 – Kapricanon

+0

是的,你可以升級到3.1版本 – shankarsh15

0

Tomcat8與Spring 3.1或更高版本兼容。你切換到Spring3.1,它會被解決。

0

Tomcat 8在啓動時需要'ConfigurableEnvironment'類。這個類在3.1.0 jar和spring-core中出現。因此,你需要升級你的春天版本。