SpringBoot报错“java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/Embedded”

问题原因:缺少jdbc相关的jar包

解决方案:pom中添加依赖如下

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jdbc</artifactId>
</dependency>
 

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.ExceptionInInitializerError at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:585) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) at com.alibaba.nacos.Nacos.main(Nacos.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467) Caused by: java.lang.ExceptionInInitializerError: null at org.apache.catalina.startup.Tomcat.<clinit>(Tomcat.java:1216) at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:194) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ... 16 common frames omitted Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field static final boolean java.io.FileSystem.useCanonCaches accessible: module java.base does not "opens java.io" to unnamed module @7f690630 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at org.apache.tomcat.util.compat.JreCompat.<clinit>(JreCompat.java:131) ... 20 common frames omitted 启动nacos出现这些错误信息,代表什么意思?
最新发布
11-18
2025-10-20 16:30:55.223 INFO 17376 --- [ main] com.hugo.TestSpringBootApplication : Starting TestSpringBootApplication using Java 1.8.0_211 on LAPTOP-3C699CDA with PID 17376 (D:\我的学习日志\Java\Project\StudyBiliBiliMaven\BookcitySpringBoot\target\classes started by 26412 in D:\我的学习日志\Java\Project\StudyBiliBiliMaven) 2025-10-20 16:30:55.234 INFO 17376 --- [ main] com.hugo.TestSpringBootApplication : No active profile set, falling back to 1 default profile: "default" 2025-10-20 16:30:56.707 INFO 17376 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9999 (http) 2025-10-20 16:30:56.748 INFO 17376 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-10-20 16:30:56.748 INFO 17376 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.69] 2025-10-20 16:30:56.981 INFO 17376 --- [ main] o.a.c.c.C.[.[localhost].[/Bookcity] : Initializing Spring embedded WebApplicationContext 2025-10-20 16:30:56.981 INFO 17376 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1672 ms 2025-10-20 16:30:57.687 WARN 17376 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration$JdbcTransactionManagerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jdbc.datasource.DataSourceTransactionManager]: Factory method 'transactionManager' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/support/JdbcTransactionManager 2025-10-20 16:30:57.691 INFO 17376 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2025-10-20 16:30:57.713 INFO 17376 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-10-20 16:30:57.756 ERROR 17376 --- [ main] o.s.boot.SpringApplication : Application run failed
10-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值