![](/img/trans.png)
[英]Apache Tomcat and Apache TomEE server is not running web projects in eclipse
[英]Springboot 202 with Apache Tomcat (TomEE)/8.5.6 (7.0.2)
我正在尝试在 Apache Tomcat (TomEE)/8.5.6 (7.0.2) 上部署 Springboot 202 应用程序。
在部署生成的 war 文件 (customotmmportal.war) 期间,tomee 启动时我没有看到任何错误,但tomee在打印这些行后挂起。
错误:
localhost-startStop-1 2022-05-06T13:40:09,322 | 信息 | 会话=402906812 | 用户=自定义用户 | com.server.scheduler.task.UpdateScheduledJobTask | 已更新计划作业名称:资产过期事件 localhost-startStop-1 2022-05-06T13:40:09,343 | 信息 | 会话=402906812 | 用户=自定义用户 | com.server.security.session.task.LogoutTask | 用户 customuser(会话 402906812)已注销 localhost-startStop-1 2022-05-06T13:40:09,435 | 信息 | 会话= | 用户= | 打开EJB.tomcat | ---------------------- localhost -> /customotmmportal localhost-startStop-1 2022-05-06T13:40:09,915 | 信息 | 会话= | 用户= | org.apache.jasper.servlet.TldScanner | 至少对一个 JAR 进行了 TLD 扫描,但不包含 TLD。 为该记录器启用调试日志记录,以获得已扫描但未在其中找到 TLD 的 JARs 的完整列表。 在扫描过程中跳过不需要的 JARs 可以缩短启动时间和 JSP 编译时间。
localhost-startStop-1 2022-05-06T13:40:09,942 | 信息 | 会话= | 用户= | org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[ /customotmmportal] | 1 Spring 在类路径上检测到 WebApplicationInitializers
**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>
尝试将 mainclass 和 package 添加到 pom.xml 文件中的 war 作为
<start-class>com.example.YourMainClass</start-class>
和
<packaging>war</packaging>
并在您的主要方法上更改为
SpringApplication.run(SpringBootApp.class,args);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.