Search code examples
dockercontinuous-deploymentopen-liberty

Getting "A feature definition could not be found for microprofile-5.0" after deploying Open Liberty Docker image on Kubernetes


We are facing an issue were we are trying to upgrade our liberty version from 19.0.0.6 to 23.0.0.1. We are deploying the applications as containerized application on K8 cluster using open-liberty:kernel-slim-java8-openj9-ubi image.

This the Dockerfile that builds the image:

FROM registry.access.redhat.com/ubi8/openjdk-8:1.14-14.1675788284 AS builder
LABEL maintainer="IBM Java Engineering at IBM Cloud"
# Copy the war file over to the open liberty image
FROM icr.io/appcafe/open-liberty:kernel-slim-java8-openj9-ubi
# disable vulnerable TLS algorithms
USER root
RUN sed -i 's/jdk.tls.disabledAlgorithms=/jdk.tls.disabledAlgorithms=SSLv2Hello, DES40_CBC, RC4_40, SSLv2, TLSv1, TLSv1.1, /g' /opt/java/openjdk/jre/lib/security/java.security
USER 1001
COPY target/liberty/wlp/usr/servers/defaultServer /config/
COPY target/*.war /config/apps/
RUN chmod g+w /config/apps
RUN chmod -R g+w /opt/ibm/wlp/bin/tools
USER 1001

And this is a snippet from the server.xml in application source:

<server description="Sample Liberty server">

  <featureManager>
      <feature>microProfile-5.0</feature>
  </featureManager>

  ...

</server>

After the application is deployed, we are currently seeing an error A feature definition could not be found for microprofile-5.0 in the logs of the application.


Solution

  • NOTE:

    This question and answer applies to Docker more generally, (not just Kubernetes).

    You have two options:

    1) Add RUN features.sh to install Liberty features on top of a 'kernel-slim' image

    If you're building from a kernel-slim tag image like FROM icr.io/appcafe/open-liberty:kernel-slim-java8-openj9-ubi you would typically need to run the features.sh script within your Dockerfile build to install the appropriate features.

    RUN features.sh
    

    This will install the features configured in your server config (server.xml) on top of the kernel-slim tagged images, which is a minimal, base image.

    This is noted in the doc.

    This allows to you to ideally end up with a smaller application image, at the expense of a bit more complicated, potentially longer build sequence.

    2) OR,another option is to use one of the 'full' images

    You could also pull one of the full tag images like icr.io/appcafe/open-liberty:full-java8-openj9-ubi. This allows to you to have a shorter build sequence (potentially quicker), at the expense of ending up with a larger application image.