Huang-ShuXing opened a new issue #1076: RpcProxy注入bean失败 URL: https://github.com/apache/incubator-brpc/issues/1076 springboot 项目集成brpc,服务间调用,注入brpc接口;启动的时候经常会报bean创建失败,重启有可能解决该问题,但是比较困难 brpc 2.5.9版本 代码 @Slf4j @Service public class UserRemoteServiceImpl implements UserRemoteService { @RpcProxy InsideUserInfoApiService userInfoService; .... } 错误日志: 2020-03-28 10:44:10,341 [main] [SpringApplication.java:842] [ERROR SpringApplication] - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRemoteServiceImpl': Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.xxxx.userservice.interfaces.InsideUserInfoApiService com.xxxx.course.service.remote.impl.UserRemoteServiceImpl.userInfoService; nested exception is java.lang.RuntimeException: Error creating bean with name 'InsideUserInfoApiService': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at com.baidu.brpc.spring.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:233) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1350) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:580) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 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.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) at com.xxxx.course.Application.main(Application.java:26) Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.xxxx.userservice.interfaces.InsideUserInfoApiService com.xxxx.course.service.remote.impl.UserRemoteServiceImpl.userInfoService; nested exception is java.lang.RuntimeException: Error creating bean with name 'InsideUserInfoApiService': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at com.baidu.brpc.spring.annotation.CommonAnnotationBeanPostProcessor$AutowiredFieldElement.inject(CommonAnnotationBeanPostProcessor.java:351) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) at com.baidu.brpc.spring.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:231) ... 17 common frames omitted Caused by: java.lang.RuntimeException: Error creating bean with name 'InsideUserInfoApiService': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at com.baidu.brpc.spring.boot.autoconfigure.SpringBootAnnotationResolver.annotationAtField(SpringBootAnnotationResolver.java:125) at com.baidu.brpc.spring.annotation.CommonAnnotationBeanPostProcessor$AutowiredFieldElement.inject(CommonAnnotationBeanPostProcessor.java:345) ... 19 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'InsideUserInfoApiService': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) at com.baidu.brpc.spring.boot.autoconfigure.SpringBootAnnotationResolver.createRpcProxyFactoryBean(SpringBootAnnotationResolver.java:376) at com.baidu.brpc.spring.boot.autoconfigure.SpringBootAnnotationResolver.parseRpcProxyAnnotation(SpringBootAnnotationResolver.java:316) at com.baidu.brpc.spring.boot.autoconfigure.SpringBootAnnotationResolver.annotationAtField(SpringBootAnnotationResolver.java:123) ... 20 common frames omitted Caused by: java.lang.ExceptionInInitializerError: null at com.baidu.brpc.client.BrpcProxy.getProxy(BrpcProxy.java:143) at com.baidu.brpc.spring.RpcProxyFactoryBean.afterPropertiesSet(RpcProxyFactoryBean.java:141) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1767) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704) ... 29 common frames omitted Caused by: java.lang.IllegalArgumentException: null at org.objectweb.asm.ClassVisitor.<init>(Unknown Source) at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:49) at net.sf.cglib.core.DefaultGeneratorStrategy.getClassVisitor(DefaultGeneratorStrategy.java:30) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24) at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329) at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) at net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) at net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ... 33 common frames omitted
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
