1 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor 2 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1011) 3 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:957) 4 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) 5 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) 6 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) 7 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) 8 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) 9 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) 10 at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:741) 11 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 12 at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) 13 at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) 14 at com.bjsxt.service.UserServiceTest.testAdd(UserServiceTest.java:14) 15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 17 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 18 at java.lang.reflect.Method.invoke(Method.java:597) 19 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) 20 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 21 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) 22 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) 23 at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) 24 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) 25 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) 26 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) 27 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) 28 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) 29 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) 30 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) 31 at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 32 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 33 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 34 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 35 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 36 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 37 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 38 Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor 39 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) 40 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) 41 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1004) 42 ... 35 more 43 Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor 44 at org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry.<init>(DefaultAdvisorAdapterRegistry.java:50) 45 at org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry.<clinit>(GlobalAdvisorAdapterRegistry.java:32) 46 at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.<init>(AbstractAutoProxyCreator.java:116) 47 at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.<init>(AbstractAdvisorAutoProxyCreator.java:48) 48 at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.<init>(AspectJAwareAdvisorAutoProxyCreator.java:47) 49 at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.<init>(AnnotationAwareAspectJAutoProxyCreator.java:49) 50 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 51 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 52 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 53 at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 54 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) 55 ... 37 more 56 Caused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor 57 at java.net.URLClassLoader$1.run(URLClassLoader.java:200) 58 at java.security.AccessController.doPrivileged(Native Method) 59 at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 60 at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 61 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 62 at java.lang.ClassLoader.loadClass(ClassLoader.java:252) 63 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) 64 ... 48 more
原因:Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
说明可能是缺少 aopalliance.jar包。