Spring 框架 使用aop 的时候 出现错误 Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint



SomeBean

public class SomeBean {
    public Integer someMethod(int agrs){
        return agrs+1;
    }
}


MyService

public class MyService {
    public void before(){
        System.out.println("before...");
    }
}





aop配置

    <bean id="someBean" class="gyl.day2._08_aspect.SomeBean"/>
    <bean id="myService" class="gyl.day2._08_aspect.MyService"/>

    <aop:config>
        <aop:pointcut id="pc" expression="execution(* gyl.day2._08_aspect.SomeBean.*(..))"/>
        <aop:aspect ref="myService">
            <aop:before method="before" pointcut-ref="pc"/>
        aop:aspect>
    aop:config>

测试代码:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class AspectTest {

    @Autowired
    private SomeBean someBean;

    @Test
    public void test(){
        someBean.someMethod(1);
    }
}








错误代码:

"C:\Program Files\Java\jdk1.8.0_162\bin\java" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:F:\IntelliJ IDEA 2017.1\lib\idea_rt.jar=60507:F:\IntelliJ IDEA 2017.1\bin" -Dfile.encoding=UTF-8 -classpath "F:\IntelliJ IDEA 2017.1\lib\idea_rt.jar;F:\IntelliJ IDEA 2017.1\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_162\jre\lib\rt.jar;D:\javaee\项目\Spring\out\test\Spring;D:\javaee\项目\Spring\out\production\Spring;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-aop-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-aspects-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-beans-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-context-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-context-indexer-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-context-support-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-core-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-expression-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-instrument-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-jcl-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-jdbc-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-jms-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-messaging-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-orm-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-oxm-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-test-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-tx-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-web-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-webflux-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-webmvc-5.0.5.RELEASE.jar;D:\javaee\SSH框架\Spring\spring-framework-5.0.5.RELEASE\libs\spring-websocket-5.0.5.RELEASE.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\junit\arquillian-junit-container\1.4.0.Final\arquillian-junit-container-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\junit\arquillian-junit-core\1.4.0.Final\arquillian-junit-core-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\test\arquillian-test-spi\1.4.0.Final\arquillian-test-spi-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\core\arquillian-core-spi\1.4.0.Final\arquillian-core-spi-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\core\arquillian-core-api\1.4.0.Final\arquillian-core-api-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\test\arquillian-test-api\1.4.0.Final\arquillian-test-api-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\container\arquillian-container-test-api\1.4.0.Final\arquillian-container-test-api-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\shrinkwrap\shrinkwrap-api\1.2.6\shrinkwrap-api-1.2.6.jar;C:\Users\Administrator\.m2\repository\org\jboss\shrinkwrap\descriptors\shrinkwrap-descriptors-api-base\2.0.0\shrinkwrap-descriptors-api-base-2.0.0.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\container\arquillian-container-test-spi\1.4.0.Final\arquillian-container-test-spi-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\container\arquillian-container-spi\1.4.0.Final\arquillian-container-spi-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\config\arquillian-config-api\1.4.0.Final\arquillian-config-api-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\config\arquillian-config-impl-base\1.4.0.Final\arquillian-config-impl-base-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\config\arquillian-config-spi\1.4.0.Final\arquillian-config-spi-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\shrinkwrap\descriptors\shrinkwrap-descriptors-spi\2.0.0\shrinkwrap-descriptors-spi-2.0.0.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\core\arquillian-core-impl-base\1.4.0.Final\arquillian-core-impl-base-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\test\arquillian-test-impl-base\1.4.0.Final\arquillian-test-impl-base-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\container\arquillian-container-impl-base\1.4.0.Final\arquillian-container-impl-base-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\arquillian\container\arquillian-container-test-impl-base\1.4.0.Final\arquillian-container-test-impl-base-1.4.0.Final.jar;C:\Users\Administrator\.m2\repository\org\jboss\shrinkwrap\shrinkwrap-impl-base\1.2.6\shrinkwrap-impl-base-1.2.6.jar;C:\Users\Administrator\.m2\repository\org\jboss\shrinkwrap\shrinkwrap-spi\1.2.6\shrinkwrap-spi-1.2.6.jar;C:\Users\Administrator\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Administrator\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-aop-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-aspects-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-beans-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-build-src-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-context-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-context-support-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-core-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-expression-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-instrument-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-instrument-tomcat-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-jdbc-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-jms-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-messaging-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-orm-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-oxm-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-test-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-tx-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-web-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-webmvc-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-webmvc-portlet-4.0.0.RELEASE.jar;H:\迅雷下载\小马哥视频Java大神\07-Stef\04_Spring\课堂资料\课堂资料\jar\spring-framework-4.0.0.RELEASE\spring-framework-4.0.0.RELEASE\libs\spring-websocket-4.0.0.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 gyl.day2._08_aspect.AspectTest,test

五月 03, 2018 1:59:06 下午 org.springframework.test.context.support.AbstractContextLoader generateDefaultLocations
信息: Detected default resource location "classpath:gyl/day2/_08_aspect/AspectTest-context.xml" for test class [gyl.day2._08_aspect.AspectTest]
五月 03, 2018 1:59:06 下午 org.springframework.test.context.support.AbstractDelegatingSmartContextLoader processContextConfiguration
信息: GenericXmlContextLoader detected default locations for context configuration [ContextConfigurationAttributes@7f560810 declaringClass = 'gyl.day2._08_aspect.AspectTest', classes = '{}', locations = '{classpath:gyl/day2/_08_aspect/AspectTest-context.xml}', inheritLocations = true, initializers = '{}', inheritInitializers = true, name = [null], contextLoaderClass = 'org.springframework.test.context.ContextLoader'].
五月 03, 2018 1:59:06 下午 org.springframework.test.context.support.AnnotationConfigContextLoaderUtils detectDefaultConfigurationClasses
信息: Could not detect default configuration classes for test class [gyl.day2._08_aspect.AspectTest]: AspectTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
五月 03, 2018 1:59:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
五月 03, 2018 1:59:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@57baeedf, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@343f4d3d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@53b32d7, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5442a311, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@548e7350]
五月 03, 2018 1:59:06 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [gyl/day2/_08_aspect/AspectTest-context.xml]
五月 03, 2018 1:59:06 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.GenericApplicationContext@6c3708b3: startup date [Thu May 03 13:59:06 CST 2018]; root of context hierarchy
五月 03, 2018 1:59:07 下午 org.springframework.context.support.AbstractApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someBean' defined in class path resource [gyl/day2/_08_aspect/AspectTest-context.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#708f5957' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
五月 03, 2018 1:59:07 下午 org.springframework.test.context.TestContextManager prepareTestInstance
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@343f4d3d] to prepare test instance [gyl.day2._08_aspect.AspectTest@1dde4cb2]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someBean' defined in class path resource [gyl/day2/_08_aspect/AspectTest-context.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#708f5957' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:496)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:107)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:243)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#708f5957' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:327)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:131)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:636)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:94)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109)
at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1063)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1036)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:490)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1198)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:312)
... 55 more
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:245)
... 60 more
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
... 63 more
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 67 more




java.lang.IllegalStateException: Failed to load ApplicationContext


at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someBean' defined in class path resource [gyl/day2/_08_aspect/AspectTest-context.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#708f5957' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:496)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:107)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:243)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#708f5957' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:327)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:131)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:636)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:94)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109)
at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1063)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1036)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:490)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#708f5957': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1198)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:312)
... 55 more
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:245)
... 60 more
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
... 63 more
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 67 more




Process finished with exit code -1 

Spring 框架 使用aop 的时候 出现错误 Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint_第1张图片


虽然 我们直接将Spring 依赖的所有的jar 包 导入进来 但是 我们因为使用了 表达式语言 我们需要引入一个 第三方的jar 包

你可能感兴趣的:(Spring 框架 使用aop 的时候 出现错误 Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.JoinPoint)