开发者社区 > 云原生 > 正文

升级dubbo,从2.7.7到2.7.15时,报错,java.lang.IllegalArgumen

我想把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有关的配置如下:

提问64.png

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

原提问者GitHub用户lzh1043060917

展开
收起
大圣东游 2023-05-11 19:11:54 227 0
1 条回答
写回答
取消 提交回答
  • 问题解决了,我把依赖换成dubbo-registry-nacos 版本2.7.15,不再报这个错误了。可能是之前使用的依赖nacos-discovery-spring-boot-starter错了吧

    原回答者GitHub用户lzh1043060917

    2023-05-12 11:04:06
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
Dubbo开源现状与2.7规划 立即下载
Dubbo分布式服务治理实战 立即下载
《Dubbo 3.0 前瞻》 立即下载