我正在使用 Spring Boot 3.3.2 开发一个 REST 应用程序,打包为 WAR,并将其部署在 JBoss EAP 8.0 上。我的应用程序使用 Java 21。应用程序部署成功,但我在日志中遇到以下错误:
Aug 02, 2024 12:55:25 PM org.jboss.logmanager.JBossLoggerFinder getLogger
ERROR: The LogManager accessed before the "java.util.logging.manager" system property was set to "org.jboss.logmanager.LogManager". Results may be unexpected.
POM 文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<relativePath/>
</parent>
<groupId>my.domain.product</groupId>
<artifactId>myapp</artifactId>
<version>0.1.0-Beta</version>
<packaging>war</packaging>
<name>changed due to NDA</name>
<description>application description</description>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>jboss-web.xml</include>
<include>jboss-deployment-structure.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
JBoss部署结构:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.logging.log4j.api"/>
<module name="org.apache.logging.log4j.core"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
我还创建了一个
spring-logback.xml
文件来配置日志记录,它按预期提供日志。但是还是出现上面提到的错误。
问题:
java.util.logging.manager
系统属性?任何帮助或指导将不胜感激。谢谢!
通过正确设置 java.util.logging.manager 系统属性并确保应用程序和服务器配置同步,您应该能够解决该错误。如果问题仍然存在,请考虑检查 JBoss EAP 日志中是否有任何其他错误消息,这些消息可以进一步深入了解问题。