I am trying to deploy as WAR and run Spring Boot application on WebSphere Liberty 23.0.0.9 using IntelliJ IDEA's WebSphere/Liberty Server run configuration.
I am using Java 11 and Spring Boot 2.4.5.
I successfully built the WAR file and deployed it, but Spring Boot application does not run.
There are no issues in running this application as a standalone jar on Spring Boot's embedded Tomcat.
I cannot figure out what is missing in Maven dependencies, Spring configuration or server.xml to make this work.
Here is how SpringBootApplication class looks like:
@SpringBootApplication(scanBasePackages = "main.package", exclude = { JmxAutoConfiguration.class })
@EntityScan(basePackages = "main.package.domain.model")
@EnableJpaRepositories(basePackages = "main.package.domain.repository")
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
Use the following features in server.xml:
<featureManager>
<feature>localConnector-1.0</feature>
<feature>servlet-6.0</feature>
<feature>pages-3.1</feature>
<feature>xmlBinding-4.0</feature>
<feature>persistence-3.1</feature>
<feature>messagingClient-3.0</feature>
<feature>messagingServer-3.0</feature>
<feature>appSecurity-5.0</feature>
<feature>restConnector-2.0</feature>
</featureManager>
Here is configuration of maven-war-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<goals>
<goal>war</goal>
</goals>
<phase>package</phase>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
In logs Liberty informs me that war was deployed, but application is not run (I do not see any Spring Boot logs and Application.configure is not invoked):
[AUDIT ] CWWKT0016I: Web application available (default_host): http://172.23.196.86:9082/app/
[AUDIT ] CWWKZ0001I: Application app started in 27,568 seconds.
[AUDIT ] CWWKF0012I: The server installed the following features: [appSecurity-5.0, cdi-4.0, distributedMap-1.0, expressionLanguage-5.0, jdbc-4.2, jndi-1.0, json-1.0, jsonp-2.1, localConnector-1.0, messagingClient-3.0, messagingServer-3.0, pages-3.1, persistence-3.1, persistenceContainer-3.1, restConnector-2.0, servlet-6.0, ssl-1.0, transportSecurity-1.0, xmlBinding-4.0].
[AUDIT ] CWWKF0011I: The localBusinessServer server is ready to run a smarter planet. The localBusinessServer server started in 37,433 seconds.
Connected to server
[2025-06-06 09:38:44,969] Artifact app:war: Artifact is being deployed, please wait...
[2025-06-06 09:38:44,987] Artifact app:war: Artifact is deployed successfully
[2025-06-06 09:38:44,987] Artifact app:war: Deploy took 18 milliseconds
You can't deploy a Spring Boot 2.x application to a Servlet 6.0 container. Spring Boot 2.x requires a Servlet 3.1+ compatible container and uses the javax.servlet
namespace. Servlet 6.0 is not backwards compatible with Servlet 3.1 as it uses the jakarta.servlet
namespace that was introduced in Servlet 5.0.
Nothing happens when you deploy your application as Liberty is looking for the application using the jakarta.servlet
entry points and your Spring Boot 2.x application does not have any. To address this, you can either upgrade to Spring Boot 3.x or deploy to a Servlet 3.1/4 compatible container.