首页 新闻 会员 周边 捐助

SpringBoot整合dubbo的时候,一启动就报错。java.lang.NoClassDefFoundError: com/alibaba/spring/util/PropertySourcesUtils

0
悬赏园豆:100 [待解决问题]

整合的时候报这个错是为什么呢?

java.lang.NoClassDefFoundError: com/alibaba/spring/util/PropertySourcesUtils
    at com.alibaba.dubbo.config.spring.context.annotation.DubboConfigBindingRegistrar.registerDubboConfigBeans(DubboConfigBindingRegistrar.java:89) ~[dubbo-2.6.5.jar:2.6.5]
    at com.alibaba.dubbo.config.spring.context.annotation.DubboConfigBindingRegistrar.registerBeanDefinitions(DubboConfigBindingRegistrar.java:80) ~[dubbo-2.6.5.jar:2.6.5]
    at com.alibaba.dubbo.config.spring.context.annotation.DubboConfigBindingsRegistrar.registerBeanDefinitions(DubboConfigBindingsRegistrar.java:54) ~[dubbo-2.6.5.jar:2.6.5]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at com.amber.Application.main(Application.java:12) [classes/:na]
Caused by: java.lang.ClassNotFoundException: com.alibaba.spring.util.PropertySourcesUtils
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_181]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_181]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_181]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_181]
    ... 19 common frames omitted

POM.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>dubbo-demo-api</artifactId>
        <groupId>com.amber.dubbo</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <artifactId>spring-boot-dubbo-demo-provider</artifactId>

    <dependencies>

        <!-- https://mvnrepository.com/artifact/com.alibaba.boot/dubbo-spring-boot-starter -->
        <dependency>
            <groupId>com.alibaba.boot</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>0.2.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.amber.dubbo</groupId>
            <artifactId>dubbo-demo-api</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>
amberbar的主页 amberbar | 初学一级 | 园豆:104
提问于:2018-12-05 07:42
< >
分享
所有回答(1)
1

PropertySourcesUtils 这个类没发现,

1: 检查这个类是属于那个jar包的,找到jar包查看里面是否有该类;

2:springboot默认扫瞄并加载的目录 是根据入口类来的;只要是入口类的同级以及子级目录均可;

3:dubbo 包 和 springboot包的版本匹配与否;

奈何一笑 | 园豆:439 (菜鸟二级) | 2018-12-05 16:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册