tomcat 8 项目发布遇到的错
1 [ERROR] 2015-05-22 22:51:38,683 org.springframework.web.servlet.DispatcherServlet - Context initialization failed 2 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.engine.ConfigurationImpl 3 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512) 4 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) 5 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) 6 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) 7 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) 8 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293) 9 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 10 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) 11 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) 12 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) 13 at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) 14 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599) 15 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665) 16 at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518) 17 at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459) 18 at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 19 at javax.servlet.GenericServlet.init(GenericServlet.java:158) 20 at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231) 21 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144) 22 at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817) 23 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 24 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 25 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 26 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) 27 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 28 at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) 29 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 30 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) 31 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) 32 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) 33 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) 34 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) 35 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 36 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 37 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 38 at java.lang.Thread.run(Thread.java:745) 39 Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.engine.ConfigurationImpl 40 at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43) 41 at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)
查阅网上资料说是 slf4j-log4j12-1.6.1.jar的版本不对,这个项目当时是从别的项目上复制过来的,在lib项目下存在两个 slf4j-log4j12.jar,我删除了 slf4j-log4j12-1.5.0.jar,重新启动项目后一切正常。