You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
Dubbo version: xxx
Operating System version: xxx
Java version: xxx
Steps to reproduce this issue
First, create an interface.
public interface DemoService {
String sayHello(String name);
}
Create a controller
@RestController
public class DemoController {
@Reference(version = "1.0.0")
private DemoService demoService;
@RequestMapping("/{name}")
public String say(@PathVariable("name") String name){
return demoService.sayHello(name);
}
}
Create a config class
@Configuration
public class DubboConfig {
@Bean(ReferenceAnnotationBeanPostProcessor.BEAN_NAME)
public ReferenceAnnotationBeanPostProcessor referenceAnnotationBeanPostProcessor(){
return new ReferenceAnnotationBeanPostProcessor();
}
@ConditionalOnMissingBean
@Bean
public ApplicationConfig applicationConfig(){
ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-consumer-test");
applicationConfig.setId("dubbo-consumer-test");
applicationConfig.setDefault(true);
return applicationConfig;
}
@ConditionalOnMissingBean
@Bean
public ProtocolConfig protocolConfig(){
ProtocolConfig protocolConfig = new ProtocolConfig("dubbo");
protocolConfig.setId("dubbo");
protocolConfig.setClient("netty4");
protocolConfig.setServer("netty4");
protocolConfig.setDefault(true);
return protocolConfig;
}
@ConditionalOnMissingBean
@Bean
public RegistryConfig registryConfig(){
RegistryConfig registryConfig = new RegistryConfig("localhost:2181");
registryConfig.setId("zookeeper");
registryConfig.setDefault(true);
registryConfig.setProtocol("zookeeper");
return registryConfig;
}
}
Create a boot class
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Invoke rest
$ curl -X GET -i 'http://localhost:8080/world'
throws exception like this(currently log's level is debug)
{"timestamp":1542107448435,"status":500,"error":"Internal Server Error","exception":"java.lang.NullPointerException","message":"No message available","path":"/world"}
starting log
2018-11-13 19:15:00.578 [main] WARN c.a.d.c.AbstractConfig - [DUBBO] null, dubbo version: 2.6.1, current host: 192.168.99.1
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at com.alibaba.dubbo.config.AbstractConfig.toString(AbstractConfig.java:473) [dubbo-2.6.1.jar:2.6.1]
at java.lang.String.valueOf(String.java:2994) [?:1.8.0_181]
at java.lang.StringBuilder.append(StringBuilder.java:131) [?:1.8.0_181]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.build(AbstractAnnotationConfigBeanBuilder.java:75) [dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferenceBean(ReferenceAnnotationBeanPostProcessor.java:345) [dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.access$100(ReferenceAnnotationBeanPostProcessor.java:61) [dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:323) [dubbo-2.6.1.jar:2.6.1]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:88) [dubbo-2.6.1.jar:2.6.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at com.fft.dubbo.consumer.Application.main(Application.java:10) [classes/:?]
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.fft.dubbo.consumer.service.DemoService. No provider available for the service com.fft.dubbo.consumer.service.DemoService:1.0.0 from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-consumer-test&default=true&dubbo=2.6.1&interface=com.fft.dubbo.consumer.service.DemoService&methods=sayHello&pid=11737®ister.ip=192.168.99.1&revision=1.0.0&side=consumer×tamp=1542107700378&version=1.0.0 to the consumer 192.168.99.1 use dubbo version 2.6.1
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) ~[dubbo-2.6.1.jar:2.6.1]
... 30 more
Application didn't exit. Here we change log's level == warn. When starting application. It crash, throws exception like this
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoController': Injection of @Reference dependencies failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.fft.dubbo.consumer.service.DemoService. No provider available for the service com.fft.dubbo.consumer.service.DemoService:1.0.0 from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-consumer-test&default=true&dubbo=2.6.1&interface=com.fft.dubbo.consumer.service.DemoService&methods=sayHello&pid=11847®ister.ip=192.168.99.1&revision=1.0.0&side=consumer×tamp=1542108310318&version=1.0.0 to the consumer 192.168.99.1 use dubbo version 2.6.1
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:92) ~[dubbo-2.6.1.jar:2.6.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at com.fft.dubbo.consumer.Application.main(Application.java:10) [classes/:?]
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.fft.dubbo.consumer.service.DemoService. No provider available for the service com.fft.dubbo.consumer.service.DemoService:1.0.0 from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-consumer-test&default=true&dubbo=2.6.1&interface=com.fft.dubbo.consumer.service.DemoService&methods=sayHello&pid=11847®ister.ip=192.168.99.1&revision=1.0.0&side=consumer×tamp=1542108310318&version=1.0.0 to the consumer 192.168.99.1 use dubbo version 2.6.1
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferenceBean(ReferenceAnnotationBeanPostProcessor.java:352) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.access$100(ReferenceAnnotationBeanPostProcessor.java:61) ~[dubbo-2.6.1.jar:2.6.1]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:323) ~[dubbo-2.6.1.jar:2.6.1]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:88) ~[dubbo-2.6.1.jar:2.6.1]
... 17 more
Also, if we didn't use log dependencies currently, there's no log also, it didn't crash either.
It seems that AbstractAnnotationConfigBeanBuilder#build() does this
public final B build() throws Exception {
checkDependencies();
B bean = doBuild();
configureBean(bean);
// use AbractConfig#toString
if (logger.isInfoEnabled()) {
logger.info(bean + " has been built.");
}
return bean;
}
Environment
Steps to reproduce this issue
throws exception like this(currently log's level is debug)
starting log
Application didn't exit. Here we change log's level == warn. When starting application. It crash, throws exception like this
Here's dubbo-consumer-test
Also, if we didn't use log dependencies currently, there's no log also, it didn't crash either.
It seems that
AbstractAnnotationConfigBeanBuilder#build()
does thisAnd
AbstractConfig#toString()
It invoked
getObject()
method, and then catched logs, but not throwed.ReferenceAnnotationBeanPostProcessor#buildReferenceBean
If we use log's level greater than info,
referenceBean.get()
will work, the application will crash.So, Dubbo should have the same behavior whatever log's level is?
The text was updated successfully, but these errors were encountered: