Docker image throws java error on one system but not another

connor898
Mon, 15 Jul 2024 18:21:29 +0000
General

I have a docker image (java tomcat app) that I built and pushed to a private registry. When pulling it onto a remote server and running it I keep getting error 500 and:

jakarta.servlet.ServletException: Filter execution threw an exception

root cause:

java.lang.NoSuchMethodError: 'com.fasterxml.jackson.core.util.JacksonFeatureSet com.fasterxml.jackson.core.JsonParser.getReadCapabilities()'

on line:

User user = mapper.readValue(json, User.class);

I pulled the image on my local machine and it works just fine. Both systems are Ubuntu 22.04 (my machine has a gui and docker desktop, the remote system is Ubuntu server with docker cli engine). I cannot think of why the behavior would be different across different machines and have tried searching around for a while. The issue also occurs the exact same way when building the image on each separate system

Redacted Dockerfile:

FROM tomcat:10.1.24-jdk21

RUN apt-get update && apt-get install -y default-jdk maven

WORKDIR /usr/local/<app-name>

COPY . .

# these need to be copied from the local environment due to changes in the properties across environments
RUN mv context.xml /usr/local/tomcat/conf/context.xml
RUN mv catalina.properties /usr/local/tomcat/conf/catalina.properties

RUN ["mvn", "clean", "install", "-Dmaven.test.skip=true"]
RUN ["mvn", "package", "-Dmaven.test.skip=true"]

# these lines fixed a previous error. Have also tried commenting them out
RUN mv /usr/local/tomcat/webapps /usr/local/tomcat/webapps2
RUN mv /usr/local/tomcat/webapps.dist /usr/local/tomcat/webapps

EXPOSE 8080

RUN cp /usr/local/<app-name>/target/<app-name>.war /usr/local/tomcat/webapps/<app-name>.war

2 posts - 2 participants