我在外部Tomcat中使用spring-boot部署了一个Web应用程序,并在下面得到了启动错误。
org.apache.catalina.core.ApplicationContext log
INFO: 2 Spring WebApplicationInitializers detected on classpath
Logging system failed to initialize using configuration from '-Dnop'
java.io.FileNotFoundException: /.../.../../home/work/-Dnop (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1045)
at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:303)
要在外部Tomcat服务器中部署我的应用程序,我做了3次更改。
更改1&gt;在Application.java中
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
更改2&gt;在pom.xml中
<packaging>war</packaging>
更改3&gt;在pom.xml中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
我测试了不同版本的spring-boot。
spring-boot 1.2.5 : no issue.
spring-boot 1.3.8 : has the issue.
spring-boot 1.4 : has the issue.
可能是spring-boot的错误,还是我错过了在外部Tomcat服务器上部署spring-boot的配置? 如果你能帮我解决这个问题,我们将不胜感激。
答案 0 :(得分:0)
这是一个错误。发生这种情况的原因之一是因为Tomcat的\ conf \ logging.properties中没有文件。
无论如何,问题已从Spring Boot 1.4.3 cf https://github.com/spring-projects/spring-boot/pull/7639
开始修复