OpenLiberty / guide-getting-started

An introductory guide to writing and deploying applications on Open Liberty using Maven and Docker: https://openliberty.io/guides/getting-started.html
Other
15 stars 54 forks source link

Cannot package runnable jar locally #297

Closed rlzh closed 1 year ago

rlzh commented 1 year ago

When following the guide on my own machine, I cannot build a runnable jar using the command: mvn liberty:package -Dinclude=runnable

(Found a similar issue on here: https://github.com/OpenLiberty/guide-microprofile-config/issues/7 but couldn't determine the fix for this project)

This is not an issue on the cloud-hosted environment when I tried it, only on my own machine.

Please see below for details. Any help or feedback would be appreciated. Thanks!

Output:

[INFO] Scanning for projects... [INFO] [INFO] ------------< io.openliberty.guides:guide-getting-started >------------- [INFO] Building guide-getting-started 1.0-SNAPSHOT [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] --- liberty-maven-plugin:3.7.1:package (default-cli) @ guide-getting-started --- [INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-kernel:null:23.0.0.1:zip. [INFO] CWWKM2102I: Using installDirectory : /home/ryan/git/temp/guide-getting-started/finish/target/liberty/wlp. [INFO] CWWKM2102I: Using serverName : defaultServer. [INFO] CWWKM2102I: Using serverDirectory : /home/ryan/git/temp/guide-getting-started/finish/target/liberty/wlp/usr/servers/defaultServer. [INFO] Installing assembly... [INFO] Expanding: /home/ryan/.m2/repository/io/openliberty/openliberty-kernel/23.0.0.1/openliberty-kernel-23.0.0.1.zip into /home/ryan/git/temp/guide-getting-started/finish/target/liberty [INFO] CWWKM2134I: Packaging server defaultServer. [INFO] Copying 1 file to /home/ryan/git/temp/guide-getting-started/finish/target/liberty/wlp/usr/servers/defaultServer [INFO] CWWKM2144I: Update server configuration file server.xml from /home/ryan/git/temp/guide-getting-started/finish/src/main/liberty/config/server.xml. [INFO] CWWKM2136I: Package file location is /home/ryan/git/temp/guide-getting-started/finish/target/guide-getting-started.jar. [INFO] CWWKM2001I: Invoke command is [/home/ryan/git/temp/guide-getting-started/finish/target/liberty/wlp/bin/server, package, defaultServer, --archive=/home/ryan/git/temp/guide-getting-started/finish/target/guide-getting-started.jar, --include=runnable]. [INFO] [INFO] Packaging server defaultServer. [INFO] Server defaultServer is running. [INFO] Server defaultServer package failed. It must be stopped before it can be packaged. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.675 s [INFO] Finished at: 2023-03-01T14:20:44-05:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:package (default-cli) on project guide-getting-started: CWWKM2002E: Failed to invoke [/home/ryan/git/temp/guide-getting-started/finish/target/liberty/wlp/bin/server, package, defaultServer, --archive=/home/ryan/git/temp/guide-getting-started/finish/target/guide-getting-started.jar, --include=runnable]. RC= 3 but expected=[0]. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

JDK:

openjdk version "11.0.17" 2022-10-18 IBM Semeru Runtime Open Edition 11.0.17.0 (build 11.0.17+8) Eclipse OpenJ9 VM 11.0.17.0 (build openj9-0.35.0, JRE 11 Linux amd64-64-Bit Compressed References 20221031_559 (JIT enabled, AOT enabled) OpenJ9 - e04a7f6c1 OMR - 85a21674f JCL - a94c231303 based on jdk-11.0.17+8)

Maven:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /opt/apache-maven-3.6.3 Java version: 11.0.17, vendor: IBM Corporation, runtime: /opt/jdk/jdk-11.0.17+8 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.15.79.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

OS: (from WSL on Windows)

PRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.2 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy

Also tested and failed when using maven:3.9.0-ibm-semeru-11-focal container image

shin19991207 commented 1 year ago

Hi @rlzh

Thank you for reporting this issue. We apologize for any inconvenience this may have caused.

We have tried out the same command using WSL2 and have confirmed that we also encountered the same error. We also found the same issue reported at https://github.com/OpenLiberty/open-liberty/issues/5188#issuecomment-728916468 and are aware of the issue.

However, we would like to clarify that this is not an issue with the guide itself, but rather with the Liberty Maven Plugin. As such, we are unable to provide a fix for this problem. Would it be possible for you to try running the guide on another environment?

Thank you again for bringing this to our attention, and please let us know if you have any further questions or concerns.

rlzh commented 1 year ago

I see, no worries. Running this guide on Windows (outside of WSL2) is fine, which is my current work-around. Thanks

shin19991207 commented 1 year ago

Hi @rlzh

Great to hear that running the guide on Windows outside of WSL2 works for you.

If you have any other questions or run into any issues with the guide, please feel free to let us know. If not, could you kindly close the issue? Thank you for your time and feedback.