編譯器提示的錯(cuò)誤是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 是一個(gè)異常涯保,表示 Java 虛擬機(jī)無(wú)法找到指定的類及刻。這個(gè)異常通常發(fā)生在以下情況下:
- 類庫(kù)版本問題:指定的類可能在特定的庫(kù)版本中不存在讥珍。請(qǐng)檢查類庫(kù)的版本是否與代碼中使用的版本兼容。
- 依賴問題:應(yīng)用程序可能缺少指定的類的依賴狸剃。請(qǐng)確保項(xiàng)目中包含了相應(yīng)的依賴。
于是查看了版本依賴問題
導(dǎo)致的原因梧兼,應(yīng)該是類庫(kù)版本的問題女仰,右側(cè)依賴選項(xiàng)也提示2.6.13.
隨后,在pom.xml文件中轧抗,將2.0.1.RELEASE 修改為 2.6.13
再次運(yùn)行恩敌,成功啟動(dòng)~