1

Am getting an error when I tried to deploy an already built spring boot application to Liberty 8.5. We are using maven & Spring boot 1.5.7.

POM.XML :

<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>

<groupId>com.demo.smartdemo</groupId>
<artifactId>smartdemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>smartdemo</name>
<url>http://maven.apache.org</url>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <start-class>com.demo.smartdemo.SmartDemoLauncher</start-class>
</properties>

<dependencies>
    <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>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <start-Class>com.demo.smartdemo.SmartDemoLauncher</start-Class>

            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                    <configuration>
                        <classifier>exec</classifier>
                        <start-Class>com.demo.smartdemo.SmartDemoLauncher</start-Class>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <finalName>provider</finalName>
</build>
</project>

Application.xml - Liberty :

    <featureManager>
        <feature>springBoot-1.5</feature>
        <feature>servlet-3.1</feature>
    </featureManager>   
    <springBootApplication location="provider.jar" type="jar">
        <classloader delegation="parentLast"/>
    </springBootApplication>

I am getting below exception when I started the server.

CWWKZ0002E: An exception occurred while starting the application provider. The exception message was: java.lang.ClassCastException: com.ibm.ws.app.manager.springboot.internal.SpringBootModuleInfo cannot be cast to com.ibm.ws.container.service.app.deploy.WebModuleInfo

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    Why are you using parentLast in the configuration. Does removing that help get rid of the cast exception. Do you have a stack trace available? – Tom Watson Jul 17 '18 at 15:29
  • This was the only error appearing on the console.log –  Jul 17 '18 at 15:36
  • Thanks Tom. I tried removing the parentList but it is not working. –  Jul 17 '18 at 15:44
  • I have tried reproducing, but have not been able to. But I do get different errors doing parentLast. Can you share your application project? Looks like a simple demo project. – Tom Watson Jul 17 '18 at 16:08
  • How can I share the code. Is there any way to attach it to the question? –  Jul 18 '18 at 05:28
  • Normally I would push up the project to my github account and post a link here. – Tom Watson Jul 18 '18 at 14:03
  • Another option would be to open a github issue against https://github.com/OpenLiberty/open-liberty/issues and attach a project source zip to the issue. – Tom Watson Jul 18 '18 at 14:07
  • Thanks Tom. Created an issue as suggested.https://github.com/OpenLiberty/open-liberty/issues/4310 –  Jul 18 '18 at 14:38

0 Answers0