修改非配置文件后tomcat重新加载启动有时会报:org.springframework.beans.factory.CannotLoadBeanClassException
有时会出现这种情况有时不会,重启tomcat就没报错了,求大神帮忙解决。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.oa.maintain.examination.dao.ExaminationDaoImpl] for bean with name 'examinationDao' defined in class path resource [spring_config/spring-config-examination.xml]; nested exception is java.lang.ClassNotFoundException: com.oa.maintain.examination.dao.ExaminationDaoImpl
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:591)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1386)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
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.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.oa.maintain.examination.dao.ExaminationDaoImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1309)
... 19 more
二月 08, 2015 6:19:59 下午 org.apache.catalina.core.StandardContext startInternal
严重: Error listenerStart
二月 08, 2015 6:19:59 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/OA] startup failed due to previous errors
二月 08, 2015 6:19:59 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
二月 08, 2015 6:19:59 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
二月 08, 2015 6:19:59 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
二月 08, 2015 6:19:59 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 7018 ms
Answers
nested exception is java.lang.ClassNotFoundException: com.oa.maintain.examination.dao.ExaminationDaoImpl,没有找到com.oa.maintain.examination.dao.ExaminationDaoImpl类,按照这个路径找下是否有对应的类,看看spring_config/spring-config-examination.xml的配置文件中bean examinationDao 写的是否正确。
你修改了什么,把修改内容回退看看能否正常启动。