FROM maven:3.6.3-jdk-14 as BUILD
COPY . /usr/src/myapp/src
RUN mvn -f /usr/src/myapp/src/pom.xml clean install
FROM jboss/wildfly:14.0.1.Final
# Set the WILDFLY_VERSION env variable
ENV m_VERSION 19.0.0.Final
ENV m_SHA1 0d47c0e8054353f3e2749c11214eab5bc7d78a14
ENV JBOSS_HOME /opt/jboss/m
ENV CERT_HOME /usr/lib/jvm/java-14-openjdk-amd64/lib/security
USER root
# Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content
# Make sure the distribution is available from a well-known place
RUN cd $HOME \
&& curl -O https://download.jboss.org/wildfly/$m_VERSION /wildfly-$m_VERSION .tar.gz \
&& sha1sum wildfly-$m_VERSION .tar.gz | grep $m_SHA1 \
&& tar xf wildfly-$m_VERSION .tar.gz \
&& mv $HOME/wildfly-$m_VERSION $JBOSS_HOME \
&& rm wildfly-$m_VERSION .tar.gz \
&& chown -R jboss:0 ${JBOSS_HOME} \
&& chmod -R g+rw ${JBOSS_HOME}
# Ensure signals are forwarded to the JVM process correctly for graceful shutdown
ENV LAUNCH_JBOSS_IN_BACKGROUND true
USER jboss
# Expose the ports we're interested in
EXPOSE 8080
EXPOSE 9990
EXPOSE 9999
EXPOSE 9000
# Set the default command to run on boot
# This will boot WildFly in the standalone mode and bind to all interface
COPY --from=BUILD /usr/src/myapp/src/app/target/app-0.0.1-SNAPSHOT.war /opt/jboss/m/standalone/deployments/
ADD standalone.sh /opt/jboss/m/bin/
ADD standalone.conf /opt/jboss/m/bin/
USER root
USER jboss
CMD ["bash", "/opt/jboss/mystifly/bin/standalone.sh", "-b", "0.0.0.0"]
this is my docker file and the war file is built with java 14 but docker container is having java 1.8 version and facing the below error
deployment.app-0.0.1-SNAPSHOT.war" from Service Module Loader): com/m/service/TServiceImpl has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Solution for the above issue is much appreciated. Thanks
tried with multiple server templates and used java 14 base image still facing the issue
I don't know much about jboss wildfly, but I would suggest to use the official docker image from here https://quay.io/repository/wildfly/wildfly instead of trying to build one by yourself.
JDK 14 on March 17, 2020 and Wildfly 19 was realeased on March 18, 2020, which means both were released at almost same time.
One of the wildly release notes says:
I can think the following approaches to solve the issue:
JDK 11, but depends on what are the dependencies that you have and which components from the JDK you are using thereJDK 14. Based on this article, looks likeJDK 14is supported sinceWildfly 25JDK 17I would try to go for the third one. Keeping your tools up to date is a good practice. Newest version usually solves vulnerability, bugs and performance issues and provide some new features that could make your job easier. Of course it is not always that way. Based on the dependencies of the project, it could be that you have something that has no compatibility yet with newest version of a component. You have to deal with some trade offs and choose what is best for your project