Docker Community Forums

Share and learn in the Docker community.

ClassNotFoundException while starting a container

This post was flagged by the community and is temporarily hidden.

It’s a bit difficult to help, I don’t find a documentation for the serverjre image anywhere. One thing that is not clear is what the WORKDIR in the running container is. Maybe you should explicitly create an application folder and set it as workdir, so you know where you are. Then you say that the classpath points to a valid jar file. Just I don’t see where file consul-client-1.4.0.jar in folder /gatekeeper-oci-1.0.0.0/lib/ comes from. You derive directly from Oracle’s serverjre and just copy gatekeeper-oci-1.0.0.0.tar to /. How did you check that the jar file is there?

Try to add , "-cp","/gatekeeper-oci-1.0.0.0/lib/*.jar" to your entrypoint command to include all jars in the lib folder and loose the CLASSPATH env.

Also with ENTRYPOINT the last declaration is the one beeing used. Having two of them in a Dockerfile has no value.

This post was flagged by the community and is temporarily hidden.

My bad, I had the first entrypoint in mind, that started with the “java” cmd when I suggested to add -cp, which is a parameter to the java executable.

Honestly, I have no idea what your second entypoint (the one u used to add the -cp paramter) does, though your previous error message indicated that the used classpath does not cover all required jar’s.

Can you share the content of /gatekeeper-oci-filters-1.0.0.0/bin/gatekeeper-ingress-filters?

Hi,
As I mentioned in the previous response.
I have removed the second entrypoint and am using only one entry point ENTRYPOINT ["/gatekeeper-oci-1.0.0.0/bin/gatekeeper", “-cp”, “/gatekeeper-oci-1.0.0.0/lib/*.jar”]

The above response content is all I have in my latest DockerFile,

FROM xxx/java/serverjre:latest
MAINTAINER Tushar Sinha “xxxxxx”
ADD gatekeeper-oci-1.0.0.0.tar /
ENTRYPOINT ["/gatekeeper-oci-1.0.0.0/bin/gatekeeper", “-cp”, “/gatekeeper-oci-1.0.0.0/lib/*.jar”]
EXPOSE 7001
ADD gatekeeper-oci-filters-1.0.0.0.tar /

I sense a tremendous amount of confusion :slight_smile:

Please remove the -cp option and its parameter again. like I already wrote this ONLY would have worked for the entrypoint that started with the java command. You ignored this from my last post.

Also you ignored that I asked to see the entrypoint script and pasted your Dockerfile again. We already know the entrypoint declaration in the Dockerfile. What we don’t know is the content of your entrypoint script.