maven项目,换台电脑导入到Eclipse奇怪问题


说来很奇怪,在公司项目运行都好好的,原封不动的考到公司另一台电脑上运行就报错了,感觉项目应该没问题,部署在tomcat的jar文件都是24个,说少的话感觉也不应该,不知道大家伙有没有同样的经验和遭遇呢?

我已经没有思路了,项目应该是没问题的,因为是直接拷贝的,然后Eclipse我也拷贝过也不行

C:\Users\Administrator.m2\repository\org\apache\maven 下的文件我也从可以运行的机器上拷贝过

上面试过的方法都不行,是不是电脑上缺少什么文件?

请输入图片描述

都是缺少class,但是jar文件在tomcat中lib下都是24个,感觉应该没问题,我都对过。

2014-7-15 20:37:26 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.util.IntrospectorCleanupListener
java.lang.NoClassDefFoundError: Could not initialize class org.springframework.beans.CachedIntrospectionResults
at org.springframework.web.util.IntrospectorCleanupListener.contextDestroyed(IntrospectorCleanupListener.java:81)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2014-7-15 20:37:26 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2014-7-15 20:37:26 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.web.context.ContextCleanupListener. <clinit> (ContextCleanupListener.java:43)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 18 more </clinit>

java maven eclipse tomcat spring

涛哥叫我来视察 10 years, 5 months ago

目测Jar冲突

爷是三季稻 answered 10 years, 5 months ago

看第一个图片中的错误,猜测是commons logging不存在,或者版本冲突。查一查两个Tomcat是不是同一个版本,有没有不同的文件在公共库目录里面。

膜拜桂雏菊 answered 10 years, 5 months ago

你的maven打包是怎么打的,把所有的依赖包打到一起,还是说只打了你自己的代码?

正义的队长 answered 10 years, 5 months ago

Your Answer