如果业务模块通过@AutowrideFromBase,以非接口形式,而是以类引用基座的bean。
当调用的bean的方法时,链路存在非public方法,会出现下列异常:
Caused by: java.lang.IllegalAccessException: Class com.alipay.sofa.serverless.common.service.SpringServiceInvoker can not access a member of xxxx with modifiers "protected"。
复现方式:
基座有一个bean,类型为RegistryConfig
业务模块通过@AutowrideFromBase的方式,获得RegistryConfig对象
调用registryConfig.setScopeModel(applicationModel);
堆栈信息如下:
java.lang.reflect.UndeclaredThrowableException: null at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:780) ~[spring-aop-5.3.22.jar:5.3.22] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.22.jar:5.3.22] at org.apache.dubbo.config.RegistryConfig$$EnhancerBySpringCGLIB$$bb8ed176.checkScopeModel(<generated>) ~[dubbo-3.2.0.jar:na] at org.apache.dubbo.config.AbstractConfig.setScopeModel(AbstractConfig.java:418) ~[dubbo-3.2.0.jar:3.2.0] at org.apache.dubbo.config.bootstrap.DubboBootstrap.registry(DubboBootstrap.java:469) ~[dubbo-3.2.0.jar:3.2.0] at com.demo.module1.DubboConfiguration.init(DubboConfiguration.java:38) ~[null-null-20240105094940835-unpack/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.3.22.jar:5.3.22] ... 64 common frames omitted Caused by: java.lang.IllegalAccessException: Class com.alipay.sofa.serverless.common.service.SpringServiceInvoker can not access a member of class org.apache.dubbo.config.AbstractConfig with modifiers "protected" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102) ~[na:1.8.0_322] at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296) ~[na:1.8.0_322] at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288) ~[na:1.8.0_322] at java.lang.reflect.Method.invoke(Method.java:491) ~[na:1.8.0_322] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.invokeService(SpringServiceInvoker.java:148) ~[sofa-serverless-common-0.5.5.jar:na] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.doInvoke(SpringServiceInvoker.java:103) ~[sofa-serverless-common-0.5.5.jar:na] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.invoke(SpringServiceInvoker.java:88) ~[sofa-serverless-common-0.5.5.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.22.jar:5.3.22] ... 76 common frames omitted
如果业务模块通过@AutowrideFromBase,以非接口形式,而是以类引用基座的bean。 当调用的bean的方法时,链路存在非public方法,会出现下列异常: Caused by: java.lang.IllegalAccessException: Class com.alipay.sofa.serverless.common.service.SpringServiceInvoker can not access a member of xxxx with modifiers "protected"。
复现方式:
堆栈信息如下:
java.lang.reflect.UndeclaredThrowableException: null at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:780) ~[spring-aop-5.3.22.jar:5.3.22] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.22.jar:5.3.22] at org.apache.dubbo.config.RegistryConfig$$EnhancerBySpringCGLIB$$bb8ed176.checkScopeModel(<generated>) ~[dubbo-3.2.0.jar:na] at org.apache.dubbo.config.AbstractConfig.setScopeModel(AbstractConfig.java:418) ~[dubbo-3.2.0.jar:3.2.0] at org.apache.dubbo.config.bootstrap.DubboBootstrap.registry(DubboBootstrap.java:469) ~[dubbo-3.2.0.jar:3.2.0] at com.demo.module1.DubboConfiguration.init(DubboConfiguration.java:38) ~[null-null-20240105094940835-unpack/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.3.22.jar:5.3.22] ... 64 common frames omitted Caused by: java.lang.IllegalAccessException: Class com.alipay.sofa.serverless.common.service.SpringServiceInvoker can not access a member of class org.apache.dubbo.config.AbstractConfig with modifiers "protected" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102) ~[na:1.8.0_322] at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296) ~[na:1.8.0_322] at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288) ~[na:1.8.0_322] at java.lang.reflect.Method.invoke(Method.java:491) ~[na:1.8.0_322] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.invokeService(SpringServiceInvoker.java:148) ~[sofa-serverless-common-0.5.5.jar:na] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.doInvoke(SpringServiceInvoker.java:103) ~[sofa-serverless-common-0.5.5.jar:na] at com.alipay.sofa.serverless.common.service.SpringServiceInvoker.invoke(SpringServiceInvoker.java:88) ~[sofa-serverless-common-0.5.5.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.22.jar:5.3.22] ... 76 common frames omitted