Hey all.. When I add a javaVersion to my server.js...
# docker-commandbox
c
Hey all.. When I add a javaVersion to my server.json file eg:
Copy code
"jvm": {
    "javaVersion": "openjdk11_jdk"
}
The logs show this error.. and the container fails to start [INFO] 2023-03-17T073730Z - Starting server using generated script: /usr/bin/startup.sh /usr/bin/startup.sh: line 3: /usr/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux_hotspot_jdk-11.0.18+10/bin/java: cannot execute: required file not found But further up... Installing to: /usr/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux | | _hotspot_jdk-11.0.18+1 | | -> 576 File(s) Installed | | -> 0 File(s) ignored | | Eureka, 'javaopenjdk11 jdklockVersion' has been installed! Any help appreciated...
j
I’ll take a look in to the issue and report back if I can replicate. If you want the 11.0.18 JDK, though, just use the full JDK image as your base:
Copy code
FROM ortussolutions/commandbox:jdk11
@chapmandu I’m not seeing any issue starting up using a different JVM with Lucee 5.3.10. It may be specific to your engine. Which CF engine are you using?
p
@chapmandu take a look at the way I got this working for the CFWheels test suite. @jclausen was instrumental to get that working. Basically instead of trying to define it in the server.json, move that up to the dockerfile.
Copy code
ARG JDK_TAG=jdk11
ARG IMAGE_VERSION=3.7.0

FROM ortussolutions/commandbox:${JDK_TAG}-${IMAGE_VERSION}

#Add the H2 extension
ADD <https://ext.lucee.org/org.h2-1.3.172.lex> /usr/local/lib/serverHome/WEB-INF/lucee-server/deploy/org.h2-1.3.172.lex

ENV ENV_MODE                    "remote"
ENV BOX_SERVER_PROFILE          "none"
ENV BOX_SERVER_APP_LIBDIRS      "/app/src/docker/lib"
ENV BOX_SERVER_APP_CFENGINE     "lucee@5.3.9+166"

# WARM UP THE SERVER
RUN ${BUILD_DIR}/util/warmup-server.sh
🚀 1
💪 1
c
@jclausen FWIW I am using lucee@5.3.10.97 with ortussolutions/commandbox:alpine-3.6.3 but @Peter Amiri nailed it.. I needed to use ortussolutions/commandbox:jdk11-alpine-3.6.3 Awesome.. thank you!!
🙂 1
j
Excellent. Yes, only the Adobe images are built, by default, with the full JDK - the rest all use the JRE to save on size, unless you specify the JDK.
b
@chapmandu I don't recommend installing a second JDK into a docker image unless it's just for testing due to the wasted disk space. That said, I'm curious why that didn't work. Can you tell me what was in the
/usr/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux_hotspot_jdk-11.0.18+10/
folder?
I'm curious if the downloads for that version of java aren't in the expected format, or if it wasn't downloading correctly at all and the folder was empty or something
The console output indicates 576 files installed, so I'm rather curious if
bin/java
wasn't one of them
c
@bdw429s Thanks for the space disk tip, Peter put me on the right path. I just tried to start the container again with
"javaVersion": "openjdk11_jdk",
in the server.json. I can see the /usr/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux_hotspot_jdk-11.0.18+10 dir is created then immediately exists before I can list the file contents..
b
@chapmandu Yes, you'd need to restart the failed container with an entry point of
bash
to be able to playaround
Or just start it with
bash
to begin with and run
Copy code
box java install openjdk11_jdk
and then poke around
I guess I can do that-- I just didn't know if your specific server had a different CPU arch, etc than mine
Hmm, so if I run the following commands, it seems to work fine
Copy code
docker run -it --rm ortussolutions/commandbox bash

root@55bfe2b8e6ae:/app# box java install openjdk11_jdk
 √ | Installing package [java:openjdk11_jdk:lockVersion]
  ...
 
root@55bfe2b8e6ae:/# /usr/local/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux_hotspot_jdk-11.0.18+10/bin/java --version
openjdk 11.0.18 2023-01-17
CommandBox installs a working version of java
One thing I noticed is the path to java in your error message is
/usr/lib/CommandBox/serverJREs/...
not
/usr/local/lib/CommandBox/serverJREs/...
but I'm unclear whether you're on an older version of our Docker image, or have some other setting in place that changes the CommandBox home
j
I wasn’t able to replicate the error, but you’re right : the path in that output is incorrect for the installed JRE
👍 1
b
@chapmandu If you're able to get more info on why that java path is being used, it would be helpful-- just to make sure it's not a bug of some sort
c
I'll have a dig around to see if that path is set explicitly somewhere in our docker configs..
In the meantime, I'm using
ortussolutions/commandbox:jdk11-alpine-3.6.3
image
b
Right, of course. I just want to know why the other approach didn't work, because it should have, even though it's not the "best" approach 🙂
It at least shouldn't have errored
And the reason it caught my attention is it's the second time I've seen someone report something like that. Ben Nadel had a similar error using our Docker images, but I was unable to get him to go back and do any debugging since he had a "working solution" and moved on
But if there's some sort of bug preventing CommandBox from downloading and using Adoptium JDKs from inside a docker image, I really want to know!
c
I'd be happy to work with you to track it down, my Docker-fu is not great but I'd happy to screen-share or whatever would work..
FYI.. i was originally using the
ortussolutions/commandbox:alpine-3.6.3
image when I tried the
_"javaVersion"_: "openjdk11_jdk",
option
I ran these commands and got the same results as you:
Copy code
docker run -it --rm ortussolutions/commandbox bash

root@55bfe2b8e6ae:/app# box java install openjdk11_jdk
b
@chapmandu Ahh, that's the issue. You were using Alpine and it seems the Java builds from Adoptium (or at least the ones CommandBox is downloading) can't be linked properly on that distro!
The real error isn't that
java
isn't found, the error messages on Apline are commonly misleading
Copy code
829e2e9fa77f:/usr/lib/CommandBox/serverJREs/openjdk11_jdk_x64_linux_hotspot_jdk-11.0.18+10/bin# ldd java --version
        /lib64/ld-linux-x86-64.so.2 (0x7f882639c000)
        libz.so.1 => /lib/libz.so.1 (0x7f882617f000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f882639c000)
        libjli.so => ./../lib/jli/libjli.so (0x7f8825f6e000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f882639c000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f882639c000)
Error relocating ./../lib/jli/libjli.so: __strdup: symbol not found
Error relocating ./../lib/jli/libjli.so: __rawmemchr: symbol not found
You can see if you run the java binary through
ldd
, it shows you the "real" error which is missing so libraries
So the question now becomes whether Adoptium even has java builds that run on MUSL
Looking at the dropdowns in https://adoptium.net/temurin/releases/?version=8 it seems they have builds., but they're under "Alpine Linux"
I think CommandBox needs updated to detect alpine and request the correct builds from the API
If you look in the console output, you'll see we're sending
os=linux
to the adoptium API, but we need to be sending
os=alpine-linux
instead here
Once we detect Alpine linux, then the auto-download-from-adoptium feature should get you a binary you can run!
👍 1
c
Good work!
b
@chapmandu Ok, the next version of CommandBox will properly detect Apline Linux when downloading Adoptium JDKs. Thanks for helping me track that down! https://ortussolutions.atlassian.net/browse/COMMANDBOX-1576
👍 1
c
You’re welcome, thanks for commandbox!
👍 1