SpringBoot项目启动错误,解决方式
标签:load service control ase exce tar exception sof noclass
SpringBoot项目启动错误,错误信息如下
Connected to the target VM, address: ‘127.0.0.1:53101‘, transport: ‘socket‘
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/util/unit/DataSize
at org.springframework.boot.convert.StringToDataSizeConverter.getConvertibleTypes(StringToDataSizeConverter.java:40)
at org.springframework.core.convert.support.GenericConversionService$Converters.add(GenericConversionService.java:507)
at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:105)
at org.springframework.boot.convert.ApplicationConversionService.addApplicationConverters(ApplicationConversionService.java:116)
at org.springframework.boot.convert.ApplicationConversionService.configure(ApplicationConversionService.java:100)
at org.springframework.boot.convert.ApplicationConversionService.(ApplicationConversionService.java:61)
at org.springframework.boot.convert.ApplicationConversionService.(ApplicationConversionService.java:54)
at org.springframework.boot.convert.ApplicationConversionService.getSharedInstance(ApplicationConversionService.java:80)
at org.springframework.boot.SpringApplication.configureEnvironment(SpringApplication.java:478)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.course.application.Application.main(Application.java:11)
Caused by: java.lang.ClassNotFoundException: org.springframework.util.unit.DataSize
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more
Disconnected from the target VM, address: ‘127.0.0.1:53101‘, transport: ‘socket‘
Process finished with exit code 1
解决方式:
是因为指定父类的版本号 和 下面的depenency 版本不同。
org.springframework.boot
spring-boot-starter-parent
2.2.2.RELEASE
但是我其他的Springboot 的依赖,我又给他指定了其他的版本, 2.2.5.RELEASE,如下。
org.springframework.boot
spring-boot
2.2.5.RELEASEorg.springframework.boot
spring-boot-starter-web
2.2.5.RELEASE
这样是错误的,导致两个版本不一致。
此时可以不指定版本,因为parent已经指定了版本,直接继承父类的版本即可
org.springframework.boot
spring-boot
org.springframework.boot
spring-boot-starter-web
再重新启动项目,就会发现启动成功啦。
SpringBoot项目启动错误,解决方式
标签:load service control ase exce tar exception sof noclass
原文地址:https://www.cnblogs.com/eathertan/p/12727197.html
评论