`
conkeyn
  • 浏览: 1506513 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

dubbo java.lang.ClassCastException: java.lang.String cannot be cast to java.lan

阅读更多

dubbo java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxxxController': Injection of @DubboReference dependencies is failed; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:183) ~[spring-context-support-1.0.11.jar:?]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
	at com.echovin.demo.visit.VisitWebApplication.main(VisitWebApplication.java:12) [main/:?]
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class
	at org.apache.dubbo.config.spring.util.DubboAnnotationUtils.resolveServiceInterfaceClass(DubboAnnotationUtils.java:95) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.util.DubboAnnotationUtils.resolveInterfaceName(DubboAnnotationUtils.java:78) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.<init>(ServiceBeanNameBuilder.java:65) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.create(ServiceBeanNameBuilder.java:78) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferencedBeanName(ReferenceAnnotationBeanPostProcessor.java:303) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInjectedObjectCacheKey(ReferenceAnnotationBeanPostProcessor.java:292) ~[dubbo-2.7.8.jar:2.7.8]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:404) ~[spring-context-support-1.0.11.jar:?]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:626) ~[spring-context-support-1.0.11.jar:?]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:179) ~[spring-context-support-1.0.11.jar:?]
	... 18 more

参考: https://github.com/apache/dubbo/issues/7115

 

解决办法:

 

<dependency>
  <groupId>com.alibaba.cloud</groupId>
  <artifactId>spring-cloud-starter-dubbo</artifactId>
</dependency>
 <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>
<dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>

 依赖的spring-context-support版本要对应,过高或过低版本,将导致上面的错误

 

<dependency>
   <groupId>com.alibaba.spring</groupId>
   <artifactId>spring-context-support</artifactId>
    <version>${alibaba_spring_context_support_version}</version>-->
</dependency>

 

分享到:
评论

相关推荐

    dubbo-2.8.4.jar

    at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:190) at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:110) at ...

    dubbo2.8.4.jar

    如果使用dubbo遇到错误:com.alibaba.dubbo.remoting.RemotingException: Fail to decode request due to: RpcInvocation 请下载这个jar,替换掉你项目中的那个jar,应该可以解决。

    dubbo-monitor-simple.zip

    dubbo-monitor监控中心,基于alibaba dubbo.jar开发,解决Decode rpc invocation failed: expected map/object at java.lang.String (Ljava/lang/String)、com.alibaba.dubbo.common.URL' could not be instantiated...

    Invalid name=”com.alibaba.dubbo.config.ProtocolConfig#0″

    java.lang.IllegalStateException: Invalid name=“com.alibaba.dubbo.config.ProtocolConfig#0” contains illegal character, only digit, letter, ‘-’, ‘_’ or ‘.’ is legal 原因: 如果没有指定id属性,...

    深入解析Dubbo内核.pdf

    深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析Dubbo内核.pdf深入解析...

    dubbo找不到dubbo.xsd报错

    - schema_reference.4: Failed to read schema document 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root ...

    品优购电商系统-springboot+dubbo版.zip

    -springboot+dubbo版.zip品优购电商系统--springboot+dubbo版.zip品优购电商系统--springboot+dubbo版.zip品优购电商系统--springboot+dubbo版.zip品优购电商系统--springboot+dubbo版.zip品优购电商系统--...

    dubbo的.xsd文件分享

    解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用,解压后dubbo.xsd 即可用

    Dubbo微服务架构下的Kubernetes云平台建设实践.docx

    Dubbo微服务架构下的Kubernetes云平台建设实践.docx

    dubbo2.5.3.jar

    dubbo2.5.3.jar dubbo2.5.3.jar dubbo2.5.3.jar dubbo2.5.3.jar dubbo2.5.3.jar

    解决dubbo启动的时候报错,无法读取方案文档 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd'

    解决启动dubbo项目的时候出现,无法读取方案文档 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd',其实在你本地把dubbo.jar文件解压,然后在META-INF下边就有个dubbo.xsd,就是他

    dubbo-admin.war.zip

    dubbo-admin.war,dubbo监控中心,解压可用

    dubbo2.8.4.jar下载

    dubbo2.8.4.jar下载,不求赚分,只求一份爱心, dubbo2.8.4.jar下载 dubbo2.8.4.jar下载 dubbo2.8.4.jar下载 dubbo2.8.4.jar下载 dubbo2.8.4.jar下载

    Dubbo管理控制台dubbo admin2.X for jdk8 (window,liunx)

    运行tomcat,然后访问tomcat根目录地址 (注意里面的WEB-INF/dubbo.properties中zookeeper的地址配置正确并且zookeeper服务正在运行) 默认用户 guest guest dubbo.registry.address=zookeeper://127.0.0.1:2181 ...

    基于java的开发源码-服务框架 Dubbo.zip

    基于java的开发源码-服务框架 Dubbo.zip 基于java的开发源码-服务框架 Dubbo.zip 基于java的开发源码-服务框架 Dubbo.zip 基于java的开发源码-服务框架 Dubbo.zip 基于java的开发源码-服务框架 Dubbo.zip 基于java的...

    Dubbo文档.rar

    Dubbo文档.rar

    Java的dubbo.xsd配置文件

    eclispe配置dubbo,本地需要有dubbo.xsd,对应的Key:http://code.alibabatech.com/schema/dubbo/dubbo.xsd

    dubbo-dubbo-2.7.3.rar

    dubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo-2.7.3.rardubbo源码dubbo-dubbo...

    dubbo.xsd文件

    targetNamespace="http://code.alibabatech.com/schema/dubbo"&gt; &lt;xsd:import namespace="http://www.w3.org/XML/1998/namespace"/&gt; &lt;xsd:import namespace="http://www.springframework.org/schema/beans"/&gt; ...

Global site tag (gtag.js) - Google Analytics