spring 整合Mybatis 《报错集合,总结更新》

时间:2021-09-02 08:18:33

错误:java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

  spring整合mubatis启动报错:

   解决办法:一看這个报错是因为缺少包,这里缺少包:aspectjweaver.jar 這个包是spring aop 所用到的包,在网上下载导入這个包即可,下载地址:http://download.csdn.net/detail/luojiming1990/5432831;

   错误代码:

 2017-04-01 09:15:46 [org.mybatis.spring.mapper.ClassPathMapperScanner]-[DEBUG] Creating MapperFactoryBean with name 'itemsMapper' and 'com.kjczwl.ssm.mapper.ItemsMapper' mapperInterface
2017-04-01 09:15:46 [org.mybatis.spring.mapper.ClassPathMapperScanner]-[DEBUG] Creating MapperFactoryBean with name 'itemsMapperCustom' and 'com.kjczwl.ssm.mapper.ItemsMapperCustom' mapperInterface
2017-04-01 09:15:46 [org.mybatis.spring.mapper.ClassPathMapperScanner]-[DEBUG] Creating MapperFactoryBean with name 'orderdetailMapper' and 'com.kjczwl.ssm.mapper.OrderdetailMapper' mapperInterface
2017-04-01 09:15:46 [org.mybatis.spring.mapper.ClassPathMapperScanner]-[DEBUG] Creating MapperFactoryBean with name 'ordersMapper' and 'com.kjczwl.ssm.mapper.OrdersMapper' mapperInterface
2017-04-01 09:15:46 [org.mybatis.spring.mapper.ClassPathMapperScanner]-[DEBUG] Creating MapperFactoryBean with name 'userMapper' and 'com.kjczwl.ssm.mapper.UserMapper' mapperInterface
2017-04-01 09:15:46 [org.springframework.context.support.PropertySourcesPlaceholderConfigurer]-[INFO] Loading properties file from class path resource [db.properties]
2017-04-01 09:15:46 [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed
java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getDeclaredMethods(Class.java:1810)
at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:104)
at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:240)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:684)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
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$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 24 more

错误:nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor 

运行环境:jdk1.7.0_17 + tomcat 7 + eclipse

    spring整合mybatis启动时候出现這个错误:

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/spring/applicationContext-transaction.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor

  解决办法:

    缺少包:aopalliance.jar

      前往地址: http://sourceforge.net/projects/aopalliance/files/ 下载包拷到你的工程里面去,如果在以后看到“NoClassDefFoundError:xxxxxxxx”一般都是缺少什么包,仔细看看你的工程是否缺少什么包之类的。

    aopalliance.jar作用:这个包是AOP联盟的API包,里面包含了针对面向切面的接口,通常Spring等其它具备动态织入功能的框架依赖此包。

错误:Configuration problem: Id is required for element 'advice' when used as a top-level tag

   spring整合mybatis启动报错:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Configuration problem: Id is required for element 'advice' when used as a top-level tag

    解决办法:字面意思已经很明确的当“advice”這个标签作为*元素时候,這个标签需要id属性,

        spring 整合Mybatis  《报错集合,总结更新》