I am trying to deploy my spring boot application on WebSphere 9 but is giving me: Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /test
My pom is
<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 https://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>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</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-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>paketobuildpacks/builder-jammy-base:latest</builder>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
and my rest is
@RestController
public class restCont {
@GetMapping("/test")
public String test() {
return "test";
}
}
I deployed it and it was successful but I cant access my rest Api what configurations I should add to be able to have rest on my WebSphere.
You need to use versions of SpringBoot/Spring and Java compatible with WebSphere V9.
<properties>
<java.version>8</java.version>
</properties>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.17</version>
NOTE: To use newer versions of Java and SpringBoot 3.x / Spring 6 you can use WebSphere Liberty / Open Liberty, see: https://openliberty.io/blog/2023/09/19/23.0.0.9.html