淘先锋技术网

首页 1 2 3 4 5 6 7

com.alibaba.spring.util.PropertySourcesUtils异常

 

springboot2.1整合dubbo时遇到了个问题 项目启动时报个异常  网上搜索了下遇到这个问题的人比较少

后来在一个博客中看到  搬运过来 希望帮到更多的人

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.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:364) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$$Lambda$134/9217520.accept(Unknown Source) ~[?:?]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:676) ~[?:1.8.0_20]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:363) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:145) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
    at com.saicfc.efsw.VehicleMovementMainApp.main(VehicleMovementMainApp.java:29) [classes/:?]
Caused by: java.lang.ClassNotFoundException: com.alibaba.spring.util.PropertySourcesUtils
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_20]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_20]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_20]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_20]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_20]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[?:1.8.0_20]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_20]
    ... 22 more

 

解决方案:

# 在 pom.xml 添加一下依赖

<dependency>

     <groupId>com.alibaba.spring</groupId>

   <artifactId>spring-context-support</artifactId>

</dependency> 

#gradle

compile 'com.alibaba.spring:spring-context-support'

 

转自:https://blog.csdn.net/SIMBA1949/article/details/86672926