1、报错
org.springframework.security.authentication.InternalAuthenticationServiceException: No MethodInvocation found: Check that an AOP invocation is in progress, and that the CrudMethodMetadataPopulatingMethodInterceptor is upfront in the interceptor chain.; nested exception is java.lang.IllegalStateException: No MethodInvocation found: Check that an AOP invocation is in progress, and that the CrudMethodMetadataPopulatingMethodInterceptor is upfront in the interceptor chain.
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:123)
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:144)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:175)
原因:不加skywalking的时候,JPA接口的代理方式为JDK动态代理,加入skywalking后,JPA的接口代理方式变成了CGLIB。
2、定位、解决
2.1 解决
因为启动应用程序的agent的plugins包含了apm-spring-annotation-plugin-8.1.0.jar,将其删掉即可。
2.2 apm-spring-annotation-plugin作用
该插件可追踪Spring上下文中被@Bean
, @Service
,@Component
和@Repository
注解的方法,该插件一旦启用,会产生大量的span,从而消耗更多的资源,所以默认是把它放到了可选插件中。
参考资料:
http://edisonxu.com/2020/10/13/skywalking-intro.html
https://github.com/apache/skywalking/issues/5048
https://blog.csdn.net/sj1231984/article/details/107263991/