Deployment in Websphere(IBM) for Spring Boot application

662 Views Asked by At

We are trying to deploy a Java 8 Spring boot application using Spring data Jpa into an IBM WebSphere version 8.5.5.21 server. The application runs fine in Local, but we cannot get it running in WebSphere while deployment.

This is what I'm getting an error while deployment.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[3/2/23 18:10:22:903 IST] 0000028e SystemOut     O 2023-03-02 18:10:22.902 ERROR 1023660 --- [ebContainer : 4] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1239)

The following method did not exist:

    javax/persistence/Table.indexes()[Ljavax/persistence/Index;

The calling method's class, org.hibernate.cfg.annotations.EntityBinder, was loaded from the following location:

    wsjar:file:/opt/IBM/WebSphere/AppServer/profiles/AppSrv03/installedApps/BSIBWASNode03Cell/Schedulers_war.ear/Schedulers.war/WEB-INF/lib/hibernate-core-5.6.14.Final.jar!/org/hibernate/cfg/annotations/EntityBinder.class

The called method's class, javax.persistence.Table, is available from the following locations:

    bundleresource://234.fwk804200143/javax/persistence/Table.class
    jar:file:/opt/IBM/WebSphere/AppServer/lib/j2ee.jar!/javax/persistence/Table.class
    wsjar:file:/opt/IBM/WebSphere/AppServer/profiles/AppSrv03/installedApps/BSIBWASNode03Cell/Schedulers_war.ear/Schedulers.war/WEB-INF/lib/jakarta.persistence-api-2.2.3.jar!/javax/persistence/Table.class

The called method's class hierarchy was loaded from the following locations:

    javax.persistence.Table: file:/opt/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.hibernate.cfg.annotations.EntityBinder and javax.persistence.Table

This is My pom.xml configuration

<?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 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>2.7.7</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.kgisl.bsibschedulers</groupId>
    <artifactId>BSIB-Schedulers</artifactId>
    <version>1.0.0</version>
    <packaging>war</packaging>
    <name>bsibschedulers</name>
    <description>BSIB Scheduler services</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-legacy</artifactId>
            <version>1.0.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>Schedulers</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

This is my main class

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class BsibschedulersApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        System.out.println("BsibschedulersApplication Started");
        SpringApplication.run(BsibschedulersApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        System.out.println("BsibschedulersApplication Configure");
        return application.sources(BsibschedulersApplication.class);
    }
}

Converting Spring boot project to War file and the deployed. Do anyone know what I am doing wrong..!!

Any one facing the issue like this.

2

There are 2 best solutions below

0
covener On

Spring Framework 5.x and Spring Boot 2.x require an application server supporting Java EE 7. WebSphere Application Server traditional in 9.0.5, WebSphere Liberty, and Open Liberty all support a minimum of Java EE 7, so they are compatible with these spring versions

WebSphere Application Server traditional in 8.5.5 does NOT support Java EE 7 , so it is NOT compatible with these Spring versions

https://www.ibm.com/support/pages/node/6612943

0
Sakthi Prasad S On

Spring Boot 2.7.9 or 2.7.7 requires at least Servlet 5.0 specification and Java 17. It is not compatible with WebSphere Liberty 8.5.5.21, which supports Servlet 3.0 and Java 7/8.

You can refer this -- Spring boot Deployment in Websphere

Note: This mentioned for WebSphere Liberty - 8.5.5.21 not for WebSphere traditional.

Hope this will help for some one to deploy Spring boot in WebSphere 8.5.5.21.