我将 spring-boot-actuator 依赖与 1.1.2 版与非 Spring Boot 应用程序一起使用,现在我想升级到 1.2.5.RELEASE 版本以在我的应用程序中使用默认的芯片健康端点。
当我升级到 1.2.5.RELEASE 时,应用程序无法启动并出现错误
Could not open ServletContext resource [/<NONE>]
Run Code Online (Sandbox Code Playgroud)
我可以看到配置位置在 AbstractRefreshableConfigApplicationContext 中被设置为 NONE,因此在 XmlBeanDefinitionReader 中它因此错误而失败。
任何帮助表示赞赏。
这是完整的堆栈跟踪:
[INFO ] 2017-11-30 16:25:47.714 [RMI TCP Connection(5)-127.0.0.1] c.w.w.u.s.MyPropertiesInitializer - Registering PropertySource my-eventhub.config with Spring Environment
[ERROR] 2017-11-30 16:31:13.914 [RMI TCP Connection(5)-127.0.0.1] o.s.w.c.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/<NONE>]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/<NONE>]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用log4j的log4j2.xml,但我一直在使用
log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
Run Code Online (Sandbox Code Playgroud)
文件位于src/main/resources下
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="WIP">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %MDC{threadTrackId} %40c{1.} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="console"/>
</Root>
<Logger name="com.test" level="debug"/>
<Logger name="org.springframework" level="info"/>
</Loggers>
</Configuration>
Run Code Online (Sandbox Code Playgroud)
我不确定文件是否正确定位但其中的appender未正确读取或文件未找到.
在我的pom文件中,我有以下依赖项
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我在pom中的构建部分
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.wirecard.wip.db.RecreateDatabase</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads> …
Run Code Online (Sandbox Code Playgroud)