7、springboot项目启动时候提示:Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
总结
前言
一、问题案例
1、maven项目compile时候出现告警warn
告警提示:
Parameter 'compilerVersion' (user property 'maven.compiler.compilerVersion') is deprecated: This parameter is no longer evaluated by the underlying compilers, instead the actual version of the javac binary is automatically retrieved. [INFO] Recompiling the module because of changed source code.
这会在类路径中包括 `your-jar-file.jar` 和 `lib` 目录中的所有 JAR 文件。
通过这些步骤,你应该能够正确地指定和找到主类,并成功运行你的 Java 应用程序。
3、程序找不到数据库驱动和配置实例
问题和解决:
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
这个错误信息 `Failed to determine a suitable driver class` 表示 Spring Boot 在尝试创建数据源时,无法确定合适的数据库驱动类。这通常是由于以下几个原因之一:
### 1. **缺少数据库驱动依赖**
确保你的 `pom.xml` 中已经包含了相应的数据库驱动程序。例如,如果你使用 MySQL 数据库,应该包含以下依赖:
Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot. Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean' at org.springframework.beans.factory.support.AbstractBeanFactory.adaptBeanInstance(AbstractBeanFactory.java:410) ~[spring-beans-6.1.3.jar:6.1.3]
Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot. Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean' at org.springframework.beans.factory.support.AbstractBeanFactory.adaptBeanInstance(AbstractBeanFactory.java:410) ~[spring-beans-6.1.3.jar:6.1.3]
5、springboot项目启动的解释
问题和解决:
从日志中可以看出,你的 Spring Boot 应用程序启动时发生了一些重要事件。以下是对日志的详细解释:
### 日志解释
1. **启动信息**: ```plaintext 2024-07-24T14:17:51.254+08:00 INFO 20596 --- [ main] o.l.neg_platform.NegPlatformApplication : Starting NegPlatformApplication using Java 17.0.8 with PID 20596 (D:\WorkPace\JavaWorkpace\neg_platform\target\classes started by 86195 in D:\WorkPace\JavaWorkpace\neg_platform) ``` - 应用程序 `NegPlatformApplication` 正在使用 Java 17.0.8 版本启动,进程 ID 是 20596。 - 应用程序的运行目录在 `D:\WorkPace\JavaWorkpace\neg_platform`。
2. **没有设置活动的 Spring Profile**: ```plaintext 2024-07-24T14:17:51.263+08:00 INFO 20596 --- [ main] o.l.neg_platform.NegPlatformApplication : No active profile set, falling back to 1 default profile: "default" ``` - 没有设置活动的 Spring Profile,因此使用了默认的 "default" 配置。
3. **MyBatis Mapper 未找到**: ```plaintext 2024-07-24T14:17:51.892+08:00 WARN 20596 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[org.louis.neg_platform]' package. Please check your configuration. ``` - 这是一个警告信息,表示在指定的包 `[org.louis.neg_platform]` 中没有找到 MyBatis Mapper 接口。 - 这通常意味着你可能没有正确配置 MyBatis 的扫描路径,或是你的 Mapper 接口没有放置在正确的位置,或是没有添加必要的注解,例如 `@Mapper`。
4. **Tomcat Web 服务器启动**: ```plaintext 2024-07-24T14:17:52.218+08:00 INFO 20596 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http) ``` - 嵌入式的 Tomcat Web 服务器初始化在端口 8080 上。
7、springboot项目启动时候提示:Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
当在IDEA中连接Redis时出现"Java HotSpot™ 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended"错误,通常是因为类加载器(ClassLoader)的共享机制引发的警告。