Springboot 202 with Apache Tomcat (TomEE)/8.5.6 (7.0.2)



我正在尝试在Apache Tomcat (TomEE)/8.5.6(7.0.2)上部署Springboot 202应用程序。

在部署生成的war文件(customotimportant .war)时,我没有看到tomee启动时出现任何错误,但是tomee挂起在打印这些行之后。

错误:

localhost-startStop-1 2022-05-06T13:40:09,322 | INFO | session=402906812 | user=customuser | com.server.scheduler.task.UpdateScheduledJobTask |更新的定时作业名称:Asset Expire Eventslocalhost-startStop-1 22-05-06 t13:40:09,343 | INFO | session=402906812 | user=customuser | com.server.security.session.task.LogoutTask |用户customuser (session 402906812)已经注销localhost-startStop-1 2022-05-06T13:40:09,435 | INFO | session= | user= | OpenEJB。tomcat | ------------------------- localhost→/customotmmportallocalhost-startStop-1 2022-05-06T13:40:09,915 | INFO | session= | user= | org.apache.jasper.servlet.TldScanner |至少有一个JAR扫描了tld,但没有包含tld。为该日志记录器启用调试日志记录功能,以查看扫描到但未在其中找到tld的完整jar列表。在扫描过程中跳过不需要的jar可以改善启动时间和JSP编译时间。

localhost- startstop -1 2022-05-06T13:40:09,942 | INFO | session= | user= | org.apache.catalina.core.ContainerBase.[Catalina].[localhost]. [localhost]. [Catalina].][/customotmmportal] | 1在类路径中检测到Spring webapplicationinitializer

**Code1:**
@RestController
@EnableAutoConfiguration
public class MessageController {
@GetMapping("/hello")
public String hello() {
return "Hello World";
}
}
**code 2:**
@SpringBootApplication
public class SpringBootApp extends SpringBootServletInitializer{

@Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder builder) {
return builder.sources(SpringBootApp.class);
}
public static void main(String[] args) {
SpringApplication sa = new SpringApplication(
SpringBootApp.class);
sa.run(args);
}

}
**pom.xml:**
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>



</exclusions>
</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-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>

<build>
<finalName>customotmmportal</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

尝试在pom.xml文件中将mainclass和package添加到war中

<start-class>com.example.YourMainClass</start-class>

<packaging>war</packaging>

并在主方法上更改为

SpringApplication.run(SpringBootApp.class,args);

最新更新