spring-boot - Spring Boot War 文件未在 websphere 8.5 中运行
问题描述
我使用 spring 开发了简单的 spring boot 应用程序,并生成了部署在 Websphere 上的 WAR 文件,但它无法正常工作。相同的代码在 Tomcat 或其他服务器上工作正常。如果可能,请提供代码 github 存储库。我尝试了所有可能的情况,但我仍然面临问题。这是我的 Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 http://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>2.1.7.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.demo</groupId>
<artifactId>ClientDemo4</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ClientDemo4</name>
<description>nSure Validation Service</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
<!-- <start-class>com.demo</start-class> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</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>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.oracle</groupId> -->
<!-- <artifactId>ojdbc7</artifactId> -->
<!-- <version>12.1.0.2</version> -->
<!-- </dependency> -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- swagger -->
<dependency>
<groupId>com.mangofactory</groupId>
<artifactId>swagger-springmvc</artifactId>
<version>0.8.8</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<finalName>ClientDemo4</finalName>
</build>
</project>
这是我的主要课程
@ComponentScan
@SpringBootApplication(scanBasePackages = { "com.kgisl" })
@OpenAPIDefinition(info = @Info(title = "Towing App", version = "v1", description = "Towing Application", license = @License(name = "MIT License", url = "https://github.com/bchen04/springboot-swagger-rest-api/blob/master/LICENSE"), contact = @Contact(url = "https://in.linkedin.com/company/kgislgss", name = "")))
//@SpringBootApplication
public class CommonValidationsApplication {
public static void main(String[] args) {
SpringApplication.run(CommonValidationsApplication.class, args);
}
}
这是服务类
公共类 ServletInitializer 扩展 SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CommonValidationsApplication.class);
}
}
这是我的控制器
@RestController
public class BasicController {
@GetMapping(value="/test")
public String testMethod(String str)
{
return "You are input is:"+str;
}
}
解决方案
推荐阅读
- reactjs - 反应 useEffect 挂钩缺少依赖项 linter 警告
- python - 从html页面中提取span标签内容
- python - 如何在熊猫的时间序列中找到间隔时间?
- python - 如何使布尔字段在 Django 中仅包含一个 True 值
- python - 我们可以在图像处理中使用哪些技术来减少图像的熵?
- angular - 如何在角度 2+ 的外部文件中设置 api 端点 url
- php - 如何从 php 在 exec 中运行 rsync?
- javascript - 使用 es6 快捷方式减少代码片段中的行数
- python - ID 和月份上的 Groupby 列,并为每个月分配值作为新的 colmuns
- python - (已解决)- 在 Linux 中使用 Eric-IDE 和 pyenv