Spring-修改非配置文件后tomcat重新加载启动有时会报:org.springframework.beans.factory.CannotLoadBeanClassException

Spring-修改非配置文件后tomcat重新加载启动有时会报:org.springframework.beans.factory.CannotLoadBeanClassException

甜柠檬 发布于 2017-01-07 字数 4248 浏览 1142 回复 1

有时会出现这种情况有时不会,重启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

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灵芸 2017-03-02 1 楼

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 写的是否正确。

你修改了什么,把修改内容回退看看能否正常启动。