BCCE 1.7.1 Init Containers Fail with "java not found" After Building bcce-helper-utility Image

book

Article ID: KB0138805

calendar_today

Updated On:

Products Versions
TIBCO BusinessConnect Container Edition 1.7.1

Description

The `Dockerfile.openjdk` for `bcce-helper-utility` tried to work out the JDK location at build time and to create the `/usr/lib/jvm/temurin-17` symlink dynamically:

```dockerfile
RUN yum -y install /app/jdk-bin.rpm && \
    JAVA_ACTUAL=$(dirname $(dirname $(readlink -f $(which java)))) && \
    ln -sfn ${JAVA_ACTUAL} /usr/lib/jvm/temurin-17 && \
    rm -f /app/jdk-bin.rpm && \
    yum clean all

ENV JAVA_HOME=/usr/lib/jvm/temurin-17
ENV LANG=en_US.UTF-8
ENV PATH=${JAVA_HOME}/bin:${PATH}
```

In some environments, the Java symlink (`/usr/lib/jvm/temurin-17`) is not created correctly. `JAVA_HOME` and `PATH` then point at a location that does not contain `java`, and the container reports `java not found`.

Resolution

### 1. Fix the Dockerfile

Install the JDK first, then link to the known RPM install path. Set the ENV variables after that, then verify.

In `deployment/helm/helpers/bcce-helper-utility/Dockerfile.openjdk`, replace the install block with:

```dockerfile
# Install JDK, create stable symlink, clean up in one layer
RUN yum -y install /app/jdk-bin.rpm && \
    ln -sfn /usr/lib/jvm/java-17-temurin-jdk /usr/lib/jvm/temurin-17 && \
    rm -f /app/jdk-bin.rpm && \
    yum clean all

ENV JAVA_HOME=/usr/lib/jvm/temurin-17
ENV LANG=en_US.UTF-8
ENV PATH=${JAVA_HOME}/bin:${PATH}

# Fail the build here if Java is not usable
RUN java -version && javac -version
```

`/usr/lib/jvm/java-17-temurin-jdk` is the directory the Temurin 17 RPM installs to. If you use a different JDK RPM, confirm its install path first:

```bash
rpm -qpl jdk-bin.rpm | grep '/bin/java$'
```

Then rebuild and push the image. The `RUN java -version && javac -version` step must pass during the build.

### 2. Make sure the new image is actually pulled

Init containers in the BCCE 1.7.1 subcharts default to `imagePullPolicy: IfNotPresent`. The top-level `global.imagePullPolicy: "Always"` is not used by the subchart templates, which read `.Values.initContainers.imagePullPolicy`.

If you re-push the fixed image under the **same tag** (`1.7.1`), nodes that already cached the broken image keep using it. Either:

- Set `initContainers.imagePullPolicy: "Always"` in each subchart's `values.yaml` (`auditsafe-ds`, `auditsafe-ws`, `bcce-as`, `bcce-cas`, `fsrest`, `bcce-aus`, `bcce-cms`, `bcce-is`, `bcce-ps`, `bcce-pmp`), or
- Push the fixed image under a new tag and update the image reference, or
- Remove the cached image from the nodes.

---

## Verification

1. The image build log shows the `java -version` step passing.
2. Check the image directly:
   ```bash
   docker run --rm --entrypoint sh <registry>/bc-support/bcce-helper-utility:1.7.1 -c 'echo $JAVA_HOME; ls -l /usr/lib/jvm; java -version'
   ```
   `temurin-17` must point at an existing directory and `java -version` must print the Temurin 17 version.
3. Redeploy the Helm release. The init containers complete and the BCCE pods reach `Running`/`Ready`:
   ```bash
   kubectl get pods
   kubectl describe pod <pod> | grep -i -A3 "Image ID"
   ```
   Confirm the image digest matches the rebuilt image, not the old cached one.

---

Issue/Introduction

After building the BCCE 1.7.1 images, the pods do not start correctly. The init containers that use the `bcce-helper-utility` image (the build-helper section) fail with:

 

java not found

Additional Information

- `deployment/helm/helpers/bcce-helper-utility/Dockerfile.openjdk`
- BCCE 1.7.1 Helm charts under `deployment/helm/charts/`