【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.

简介: 【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.

【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.


一、前言

最近小编在学习springcloud的项目知识,初出茅庐,跟着视频敲,发现不对劲。视频出的时间太早了,导致和现在的SpringBoot版本不一样,这是个头疼的问题,一个不小心就版本不兼容。击退你的学习信心的往往不是复杂的技术和业务,而是简简单单的环境版本问题。下面跟着小编一起解决问题吧!!


二、报错信息(省略部分)

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.10.jar:5.3.10]
  at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.10.jar:5.3.10]
  ... 34 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
  at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration.configurationPropertiesBeans(ConfigurationPropertiesRebinderAutoConfiguration.java:56) ~[spring-cloud-context-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$1b4f1aed.CGLIB$configurationPropertiesBeans$2(<generated>) ~[spring-cloud-context-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$1b4f1aed$$FastClassBySpringCGLIB$$92bb4cd3.invoke(<generated>) ~[spring-cloud-context-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.10.jar:5.3.10]
  at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.10.jar:5.3.10]
  at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$1b4f1aed.configurationPropertiesBeans(<generated>) ~[spring-cloud-context-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.10.jar:5.3.10]
  ... 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_121]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
  ... 46 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:53071', transport: 'socket'
Process finished with exit code 1


三、解决问题

不难发现是因为Springboot和SpringCloud版本不兼容,我们打开:—>Spring Cloud官网,找到对应的版本对照,果然官网不会骗人哈,这样就可以解决问题了。大家跟着自己的版本进行对照选择!!

这里不是很详细,我们可以去Github上看详细版的:—>springboot与springcloud详细对照信息

小编的是根据视频的springboot版本是2.1.8,所以对应Greenwich.SR6


四、总结

找了这么久恍然发现,一定要看官网,不然你要走好多弯路。


相关文章
|
9月前
|
网络安全
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxxx.svc.cluster.local:8080/xxxx": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "xxxx.svc.cluster.local:8080/xxxx ": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
1075 0
|
8月前
|
Java API Maven
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
73 0
|
1月前
|
存储 Oracle 关系型数据库
实时计算 Flink版操作报错之遇到Caused by: java.sql.SQLException: ORA-44609: CONTINOUS_MINE,该怎么处理
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
|
1月前
|
JavaScript Serverless API
Serverless 应用引擎操作报错合集之在Serverless 应用引擎中,FC3.0读取response body的时候出现错误提示"Caused by: java.io.IOException: closed"如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
|
1月前
|
SpringCloudAlibaba Java Maven
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
18 2
|
1月前
|
Java 应用服务中间件 Linux
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
|
1月前
|
开发工具
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
39 2
|
1月前
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
26 0
|
1月前
|
Java 开发工具 计算机视觉
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
15 0