编译器提示的错误是org/springframework/beans/factory/config/YamlProcessor$StrictMapAppenderConstructor
[main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor$StrictMapAppenderConstructor
at org.springframework.boot.env.YamlPropertySourceLoader$Processor.createYaml(YamlPropertySourceLoader.java:86)
at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:164)
at org.springframework.boot.env.YamlPropertySourceLoader$Processor.process(YamlPropertySourceLoader.java:101)
at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:58)
at org.springframework.boot.env.PropertySourcesLoader.load(PropertySourcesLoader.java:128)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.doLoadIntoGroup(ConfigFileApplicationListener.java:490)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadIntoGroup(ConfigFileApplicationListener.java:473)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:465)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:386)
at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:225)
at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:195)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:182)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:168)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.Fallzery.UserShiroApplication.main(UserShiroApplication.java:11)
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.YamlProcessor$StrictMapAppenderConstructor
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 24 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:59179', transport: 'socket'
Process finished with exit code 1
NoClassDefFoundError 是一个异常,表示 Java 虚拟机无法找到指定的类。这个异常通常发生在以下情况下:
- 类库版本问题:指定的类可能在特定的库版本中不存在。请检查类库的版本是否与代码中使用的版本兼容。
- 依赖问题:应用程序可能缺少指定的类的依赖。请确保项目中包含了相应的依赖。
于是查看了版本依赖问题
导致的原因,应该是类库版本的问题,右侧依赖选项也提示2.6.13.
随后,在pom.xml文件中,将2.0.1.RELEASE 修改为 2.6.13
再次运行,成功启动~