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


    从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

  • 相关阅读:
    Developers’ Musthave: the new Microsoft AllInOne Code Framework Sample Browser and 3500+ samples
    8774
    DCOM
    9个最棒的代码片段资源网站
    WCF中的几种地址总结
    如何用C#编写DCOM服务器
    C++ DCOM服务器和C#客户端互操作完全解释
    理解Prism中MVVM的Command与CommandParameter
    WCF REST 基础教程
    细说ASP.NET Forms身份认证
  • 原文地址:https://www.cnblogs.com/0kuxia0/p/6893520.html
Copyright © 2020-2023  润新知