apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.51k stars 26.43k forks source link

升级dubbo,从2.7.7到2.7.15时,报错,java.lang.IllegalArgumentException: protocol = http host = null #9625

Closed lzh1043060917 closed 2 years ago

lzh1043060917 commented 2 years ago

我想把dubbo版本从2.7.7升级到2.7.15,启动项目之后,报错,错误信息: java.lang.IllegalArgumentException: protocol = http host = null at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:177) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1150) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.execute(JdkHttpClientRequest.java:112) at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosRestTemplate.java:482) at com.alibaba.nacos.common.http.client.NacosRestTemplate.get(NacosRestTemplate.java:72) at com.alibaba.nacos.client.naming.net.NamingProxy.getServerListFromEndpoint(NamingProxy.java:168) at com.alibaba.nacos.client.naming.net.NamingProxy.refreshSrvIfNeed(NamingProxy.java:203) at com.alibaba.nacos.client.naming.net.NamingProxy.initRefreshTask(NamingProxy.java:145) at com.alibaba.nacos.client.naming.net.NamingProxy.(NamingProxy.java:130) at com.alibaba.nacos.client.naming.NacosNamingService.init(NacosNamingService.java:93) at com.alibaba.nacos.client.naming.NacosNamingService.(NacosNamingService.java:81) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:60) at com.alibaba.nacos.api.NacosFactory.createNamingService(NacosFactory.java:77) at com.alibaba.nacos.spring.factory.CacheableEventPublishingNacosServiceFactory$NamingCreateWorker.run(CacheableEventPublishingNacosServiceFactory.java:274) at com.alibaba.nacos.spring.factory.CacheableEventPublishingNacosServiceFactory$NamingCreateWorker.run(CacheableEventPublishingNacosServiceFactory.java:261) at com.alibaba.nacos.spring.factory.CacheableEventPublishingNacosServiceFactory.createNamingService(CacheableEventPublishingNacosServiceFactory.java:96) at com.alibaba.nacos.spring.beans.factory.annotation.NamingServiceBeanBuilder.createService(NamingServiceBeanBuilder.java:47) at com.alibaba.nacos.spring.beans.factory.annotation.NamingServiceBeanBuilder.createService(NamingServiceBeanBuilder.java:32) at com.alibaba.nacos.spring.beans.factory.annotation.AbstractNacosServiceBeanBuilder.build(AbstractNacosServiceBeanBuilder.java:75) at com.alibaba.nacos.spring.beans.factory.annotation.AnnotationNacosInjectedBeanPostProcessor.doGetInjectedBean(AnnotationNacosInjectedBeanPostProcessor.java:116) at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:409) at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:626) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:179) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1427) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at cn.edu.seu.gateway.GatewayApplication.main(GatewayApplication.java:14) java.lang.IllegalArgumentException: protocol = http host = null at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:177) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1150) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.execute(JdkHttpClientRequest.java:112) at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosRestTemplate.java:482) at com.alibaba.nacos.common.http.client.NacosRestTemplate.get(NacosRestTemplate.java:72) at com.alibaba.nacos.client.naming.net.NamingProxy.getServerListFromEndpoint(NamingProxy.java:168) at com.alibaba.nacos.client.naming.net.NamingProxy.refreshSrvIfNeed(NamingProxy.java:203) at com.alibaba.nacos.client.naming.net.NamingProxy.access$000(NamingProxy.java:82) at com.alibaba.nacos.client.naming.net.NamingProxy$2.run(NamingProxy.java:151) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

注册中心用的是nacos。 项目的yml配置里跟dubbo和nacos有关的配置如下:

image

lzh1043060917 commented 2 years ago

不知道是我哪里弄错了,是不是dubbo.protocol那个配置需要修改一下?

juzi214032 commented 2 years ago

dubbo-registry-nacos 用的哪个版本,感觉你这个异常不是由于 dubbo 引起的,项目里除了把 nocos 作为注册中心,还有其他地方用到 nacos 吗

lzh1043060917 commented 2 years ago

dubbo-registry-nacos 用的哪个版本,感觉你这个异常不是由于 dubbo 引起的,项目里除了把 nocos 作为注册中心,还有其他地方用到 nacos 吗

我没用你说的那个依赖,我一直用的都是nacos-discovery-spring-boot-starter 版本0.2.7 nacos我用作注册中心和配置中心,配置中心的依赖是nacos-config-spring-boot-starter 版本0.2.1.

lzh1043060917 commented 2 years ago

加上dubbo-registry-nacos 依赖之后,不再报错

dubbo-registry-nacos 用的哪个版本,感觉你这个异常不是由于 dubbo 引起的,项目里除了把 nocos 作为注册中心,还有其他地方用到 nacos 吗

问题解决了,我把依赖换成dubbo-registry-nacos 版本2.7.15,不再报这个错误了。可能是之前使用的依赖nacos-discovery-spring-boot-starter错了吧