receiving runtime error on docker container only for specific machine

458 views Asked by At

I have a 3rd party java webapp that runs within apache Tomcat. We are using docker to run this application. When run on my machine, we receive an error

I want to stress that we do not build this .war. We do not own this .war. We are simply trying to spin up a docker container that runs this already built code.

javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

with the details

java.lang.IncompatibleClassChangeError: Class javax.ws.rs.core.Response$Status does not implement the requested interface javax.ws.rs.core.Response$StatusType

investigating this online a bit shows a lot of people having issues with conflicting jersey jars. We should not have that problem because we using docker for mac... and this works on everyone else's machine across multiple version of docker.

I have wiped out and reinstalled docker multiple times, restarting my machine inbetween each restart. I have used the same version as machines where it does work.

I am on OSX Sierra 10.12.2

The docker image is based on tomcat:8.5.9-jre8-alpine It copies the relevant .war to $CATALINA_HOME/webapps/ and a single log4j .jar to $CATALINA_HOME/lib/ along with a two .properties files.'

is there anything on this specific machine that could possible be interfering with the container?

Dockerfile is as follows

FROM tomcat:8.5.9-jre8-alpine@sha256:780c0fc47cf5e212bfa79a379395444a36bbd67f0f3cd9d649b90a74a1a7be20

ENV JAVA_OPTS="-Xms2048m -Xmx2048m"

WORKDIR $CATALINA_HOME

COPY ./target/lib/* $CATALINA_HOME/lib/
COPY ./target/<appname>.war $CATALINA_HOME/webapps/

EXPOSE 8080
CMD ["catalina.sh", "run"]
1

There are 1 answers

4
Eugen Mayer On

Check all the volumes, most critical ones in that case are mounts from your ~/.m2 into the container ~/.m2 .. this would explain your issue.

Other then that, it would not make sense, that it works on one machine, and not the other, as long as you use the same image AND:

a) The compilation of the WAR file does not happen on the probelematic computer ( most probably local a maven / m2 ) issue then

b) You do not do any crazy stuff in the entrypoint really hurting the paradigm ( i do no think so )

c) You mount your local m2 into the containers m2 and thus share libs

We do run a lot of tomcat containers with different war apps and they, as you expect, run absolutely cross platform.

Hint: To avoid a) always build in the image using the image java env.