记一次在Tomcat部署项目后无法启动该项目的例子

时间:2022-01-27 17:18:03

  在一次正常部署后,发现在Tomcat的管理中无法将该项目启动起来,并在Tomcat的日志文件localhost.log中发现以下错误信息:

 1 java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;  2     org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:260)  3     org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:83)  4     org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:63)  5     org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:54)  6     org.springframework.core.convert.support.DefaultConversionService.<init>(DefaultConversionService.java:43)  7     org.springframework.core.env.AbstractPropertyResolver.<init>(AbstractPropertyResolver.java:41)  8     org.springframework.core.env.PropertySourcesPropertyResolver.<init>(PropertySourcesPropertyResolver.java:41)  9     org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:98) 10     org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54) 11     org.springframework.web.context.support.StandardServletEnvironment.<init>(StandardServletEnvironment.java:44) 12     org.springframework.web.servlet.HttpServletBean.createEnvironment(HttpServletBean.java:213) 13     org.springframework.web.servlet.HttpServletBean.getEnvironment(HttpServletBean.java:203) 14     org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126) 15     javax.servlet.GenericServlet.init(GenericServlet.java:212) 16     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 17     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 18     org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) 19     org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 20     org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 21     java.lang.Thread.run(Unknown Source)

  后来发现是我在新的MyEclipse中导入了更新的Spring包 3.1.2.RELEASE ,而与我自己项目使用的Spring3.0的包冲突,因此导致如上问题的发生。

  所以以后如果一个项目在自己IDE中能部署并正常运行,而到服务器中部署无法启动,很可能是库之间有版本不同的包导致的冲突。