1

I'm following the Containerizing, packaging, and running a Spring Boot application guide. After getting it to run, I want to use my own Spring Boot application. So I took my jar, put it into the target directory and updated the server.xml file accordingly:

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
    <featureManager>
        <feature>servlet-4.0</feature>
        <feature>springBoot-2.0</feature>
    </featureManager>
    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="9080"
                  httpsPort="9443" />
    <springBootApplication id="guide-spring-boot" 
                           location="myOwnApp.jar"
                           name="guide-spring-boot" />
    <!--springBootApplication id="guide-spring-boot" 
                           location="thin-guide-spring-boot-0.1.0.jar"
                           name="guide-spring-boot" /-->
</server>

Alas, after restarting the Open Liberty server this configuration seems to be totally ignored and my application is not started.

Roland
  • 7,525
  • 13
  • 61
  • 124
  • When you say you put your app into the "target directory" did you mean just literally 'target' ? The "location" value in the server.xml would be relative to the server config dir's "apps" subdirectory, e.g.: target/liberty/wlp/usr/servers/defaultServer/apps. Typically you would use the liberty-maven-plugin "deploy" goal to get your app in that location, since this goal is aware of your app artifact (and also has useful config like whether to strip the version). Does that help? – Scott Kurz May 12 '22 at 14:32
  • Let me just mention too the guide is geared towards showing you how to develop and deploy a SpringBoot app to Open Liberty. It is also possible to reference a SpringBoot app as a Maven dependency within a module that provides the server config (server.xml) and the deployment goals. That would look a little different, which I could explain more. – Scott Kurz May 12 '22 at 14:44

0 Answers0