Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging Springboot 3 application embedded with Open Liberty does not work #26437

Closed
gkwan-ibm opened this issue Sep 28, 2023 · 1 comment · Fixed by #26438
Closed

Packaging Springboot 3 application embedded with Open Liberty does not work #26437

gkwan-ibm opened this issue Sep 28, 2023 · 1 comment · Fixed by #26438
Labels
release bug This bug is present in a released version of Open Liberty release:230010

Comments

@gkwan-ibm
Copy link
Member

gkwan-ibm commented Sep 28, 2023

Diagnostic information:

  • OpenLiberty Version: 23.0.0.9
  • Affected feature(s): springBoot-3.0
  • Java Version: 17

Problem

  • Configure the pom for minify and runnable
      <plugin>
        <groupId>io.openliberty.tools</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <version>3.8.2</version>
        <configuration>
          <appsDirectory>apps</appsDirectory>
          <installAppPackages>spring-boot-project</installAppPackages>
          <include>minify,runnable</include>
          <packageName>GSSpringBootApp</packageName>
        </configuration>
        <executions>
          <execution>
            <id>package-server</id>
            <phase>package</phase>
            <goals>
              <goal>create</goal>
              <goal>install-feature</goal>
              <goal>deploy</goal>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
  • server.xml
    <featureManager>
        <feature>servlet-6.0</feature>
        <feature>springBoot-3.0</feature>
    </featureManager>

    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="9080"
                  httpsPort="9443" />

    <springBootApplication id="guide-spring-boot" 
                           location="thin-guide-spring-boot-0.1.0.jar"
                           name="guide-spring-boot" />
  • ./mvnw package
    • it generates target/GSSpringBootApp.jar
  • java -jar target/GSSpringBootApp.jar
    • got following error
gkwan@gilberts-mbp-2 start % java -jar target/GSSpringBootApp.jar
Extracting files to /Users/gkwan/wlpExtract/GSSpringBootApp_68559353251333/wlp
Successfully extracted all product files.
Launching defaultServer (Open Liberty 23.0.0.9/wlp-1.0.81.cl230920230904-1158) on Eclipse OpenJ9 VM, version 17.0.6+10 (en_CA)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /Users/gkwan/wlpExtract/GSSpringBootApp_68559353251333/wlp/usr/servers/defaultServer/configDropins/defaults/install_apps_configuration_1491924271.xml
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.0)
2023-09-28T15:22:21.311-04:00  INFO 90897 --- [ecutor-thread-6] com.example.springboot.Application       : Starting Application using Java 17.0.6 with PID 90897 (/Users/gkwan/wlpExtract/GSSpringBootApp_68559353251333/wlp/usr/servers/defaultServer/apps/thin-guide-spring-boot-0.1.0.jar started by gkwan in /Users/gkwan/wlpExtract/GSSpringBootApp_68559353251333/wlp/usr/servers/defaultServer)
2023-09-28T15:22:21.316-04:00  INFO 90897 --- [ecutor-thread-6] com.example.springboot.Application       : No active profile set, falling back to 1 default profile: "default"
2023-09-28T15:22:22.236-04:00  WARN 90897 --- [ecutor-thread-6] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2023-09-28T15:22:22.260-04:00  INFO 90897 --- [ecutor-thread-6] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-09-28T15:22:22.275-04:00 ERROR 90897 --- [ecutor-thread-6] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:602) ~[spring-context-6.0.9.jar:6.0.9]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:733) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294) ~[spring-boot-3.1.0.jar:3.1.0]
	at com.example.springboot.Application.main(Application.java:15) ~[thin-guide-spring-boot-0.1.0.jar:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at com.ibm.ws.app.manager.springboot.internal.SpringBootRuntimeContainer.lambda$invokeSpringMain$6(SpringBootRuntimeContainer.java:139) ~[na:na]
	at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:247) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:857) ~[na:na]
Caused by: java.lang.NoClassDefFoundError: io.openliberty.checkpoint.spi.CheckpointPhase
	at io.openliberty.springboot.support.web.server.version30.container.LibertyServletWebServerFactory.getWebServer(LibertyServletWebServerFactory.java:36) ~[springBoot30Server.jar:na]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[spring-boot-3.1.0.jar:3.1.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.1.0.jar:3.1.0]
	... 17 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.openliberty.checkpoint.spi.CheckpointPhase
	at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:736) ~[na:na]
	at [internal classes]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1094) ~[na:na]
	... 20 common frames omitted
[ERROR   ] CWWKZ0002E: An exception occurred while starting the application guide-spring-boot. The exception message was: org.springframework.context.ApplicationContextException: Unable to start web server
[AUDIT   ] CWWKF0012I: The server installed the following features: [servlet-6.0, springBoot-3.0].
[AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 3.920 seconds.
@cbridgha
Copy link
Member

opened #26444 as well to reenable tests that would have caught this earlier....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release bug This bug is present in a released version of Open Liberty release:230010
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants