java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException

來源:互聯網
上載者:User

標籤:ast   博文   roc   and   xml檔案   ack   bean   mapper   配置   

從svn上把項目遷下來之後,編譯通過,但是運行一直報錯,報錯具體日誌如下:

第一段報錯?

?java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory. ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate. ~[spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext. ~[spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext. ~[spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader. ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader. ~[spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener. [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

 

第二段報錯

ava.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call ‘refresh‘ before multicasting events via the context: Root WebApplicationContext: startup date [Tue May 23 11:23:47 CST 2017]; root of context hierarchy

at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext. [spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext. [spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext. [spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext. [spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader. [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener. [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE]

 

 

解決辦法:

spring-config.xml檔案裡面?有一段Mybatis 的配置,如下

  <!-- Mapper介面所在包名,Spring會自動尋找其下的Mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value=" com.qumaiyao,com.hys.mds.project.o2o.logic" />
<property name="markerInterface" value=" com.qumaiyao.MybatisMapper"/>
</bean>

在這段配置中新加一行,

<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />

修改後的配置如下:

    <!-- Mapper介面所在包名,Spring會自動尋找其下的Mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value=" com.qumaiyao,com.hys.mds.project.o2o.logic" />
<property name="markerInterface" value=" com.qumaiyao.MybatisMapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>

這樣處理後,項目就跑起來了。

參考博文:

http://blog.csdn.net/qq_27348011/article/details/51492756?

http://peterz2011.blog.51cto.com/3186140/1313011

java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.