解决springBoot项目启动时,报org.yaml.snakeyaml.error.YAMLException: Class not found: org.apache.dubbo.admi...

小明的个人博客

前言:

最近在用springboot + dubbo框架搭建一个微服务应用,经历了一系列的mavne配置之后,莫名其妙的出现了以上异常,但不会影响项目正常启动和运行。但拥有强迫症的我。。。

异常信息:
Cannot create property=configs for JavaBean=org.apache.dubbo.rpc.cluster.configurator.parser.model.ConfiguratorConfig@52fec840
 in 'string', line 1, column 1:
    configs:
    ^
Can't construct a java object for tag:yaml.org,2002:org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter; exception=Class not found: org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter
 in 'string', line 2, column 3:
    - !!org.apache.dubbo.admin.model.a ... 
      ^

 in 'string', line 2, column 1:
    - !!org.apache.dubbo.admin.model ... 
    ^

    at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:149)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:308)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:207)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:196)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:161)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:147)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:524)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:437)
    at org.apache.dubbo.rpc.cluster.configurator.parser.ConfigParser.parseObject(ConfigParser.java:62)
    at org.apache.dubbo.rpc.cluster.configurator.parser.ConfigParser.parseConfigurators(ConfigParser.java:41)
    at org.apache.dubbo.registry.integration.AbstractConfiguratorListener.process(AbstractConfiguratorListener.java:62)
    at org.apache.dubbo.registry.integration.AbstractConfiguratorListener.initWith(AbstractConfiguratorListener.java:46)
    at org.apache.dubbo.registry.integration.RegistryProtocol$ProviderConfigurationListener.(RegistryProtocol.java:577)
    at org.apache.dubbo.registry.integration.RegistryProtocol.(RegistryProtocol.java:98)
    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 java.lang.Class.newInstance(Class.java:442)
    at org.apache.dubbo.common.extension.ExtensionLoader.createExtension(ExtensionLoader.java:526)
    at org.apache.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:344)
    at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java)
    at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:553)
    at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:402)
    at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:363)
    at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:345)
    at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:318)
    at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:112)
    at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:58)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:888)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
    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.laFerrari.comment.sync.SyncApplication.main(SyncApplication.java:27)
Caused by: Can't construct a java object for tag:yaml.org,2002:org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter; exception=Class not found: org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter
 in 'string', line 2, column 3:
    - !!org.apache.dubbo.admin.model.a ... 
      ^

    at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:313)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:207)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:196)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:373)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:357)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:516)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:207)
    at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:196)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:281)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:246)
    ... 44 more
Caused by: org.yaml.snakeyaml.error.YAMLException: Class not found: org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter
    at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:642)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:298)
    at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:308)
    ... 53 more
异常分析:

这个错误可以说是非常直观:

org.yaml.snakeyaml.error.YAMLException: Class not found: org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter

找不到BalancingDTO2OverrideConfigAdapter这个类
第一步:google搜索 "Class not found: org.apache.dubbo.admin.model.adapter.BalancingDTO2OverrideConfigAdapter" 基本找不到对应的内容


QQ截图20190509104831.png

第二步:google搜索" Can't construct a java object for tag:yaml.org,2002"

小明的个人博客

你可能感兴趣的:(解决springBoot项目启动时,报org.yaml.snakeyaml.error.YAMLException: Class not found: org.apache.dubbo.admi...)