Paresh Devalia created ATLAS-5427:
-------------------------------------

             Summary: atlas-rest Docker image fails to start on Java 8 base: 
unrecognized --add-opens JVM options
                 Key: ATLAS-5427
                 URL: https://issues.apache.org/jira/browse/ATLAS-5427
             Project: Atlas
          Issue Type: Bug
            Reporter: Paresh Devalia
            Assignee: Paresh Devalia


The {{atlas-rest}} service defined in 
{{dev-support/atlas-docker/docker-compose.atlas-rest.yml}} fails during JVM 
startup when the underlying {{atlas-base}} image (or effective 
{{{}JAVA_HOME{}}}) is Java 8.

Error (e.g. {{{}/var/log/atlas/rest-notification/rest.*.err{}}}):

{{Unrecognized option: --add-opens=java.base/java.lang=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.}}
Atlas 3.x rest-server artifacts are built for Java 17 (see 
{{ATLAS_BUILD_JAVA_VERSION}} / Maven {{jdk-17}} profile). The rest notification 
server must run on Java 17+, but the rest Docker image does not pin the JVM 
version the way the main Atlas server image does.

 
h3. Steps to reproduce
 # Build/start stack from {{dev-support/atlas-docker}} using 
{{docker-compose.atlas-rest.yml}} (with Kafka/ZK from 
{{{}docker-compose.atlas-common.yml{}}}).
 # Use an {{atlas-base}} image where {{JAVA_HOME}} resolves to Java 8, or an 
older base built before {{{}ATLAS_BASE_JAVA_VERSION=17{}}}.
 # Observe rest container logs / {{rest.*.err}} — JVM exits before 
{{RestNotificationMain}} starts.

----
h3. Root cause
 # {{Dockerfile.atlas-rest}} extends {{atlas-base}} only and does not set 
{{JAVA_HOME}} / {{update-java-alternatives}} like {{Dockerfile.atlas}} does via 
{{{}ATLAS_SERVER_JAVA_VERSION{}}}.
 # {{docker-compose.atlas-rest.yml}} sets {{REST_SERVER_OPTS}} with 
{{{}--add-opens=...{}}}, which is invalid on Java 8. Those flags are already 
added by {{distro/src/bin/rest_start.py}} → {{get_default_jvm_opts()}} when 
Java ≥ 9.

h3. Expected behavior
 * {{atlas-rest}} container starts successfully.
 * HTTP listener on port 41000 (config: {{{}atlas.rest.server.http.port{}}}).
 * Hook notification ingress available at
 {{POST /rest/api/atlas/v2/notification/topic/\{topicName}}} for payload 
validation / REST hook path.

----
h3. Proposed fix
 # {{dev-support/atlas-docker/Dockerfile.atlas-rest}}
 Add {{{}ARG ATLAS_SERVER_JAVA_VERSION{}}}, {{{}ARG TARGETARCH{}}}, set {{{}ENV 
JAVA_HOME{}}}, and run {{update-java-alternatives}} (same pattern as 
{{{}Dockerfile.atlas{}}}).

 # {{dev-support/atlas-docker/docker-compose.atlas-rest.yml}}

 ** Pass build arg: 
{{{}ATLAS_SERVER_JAVA_VERSION=${ATLAS_SERVER_JAVA_VERSION}{}}}.
 ** Optionally pass {{ATLAS_SERVER_JAVA_VERSION}} in {{{}environment{}}}.
 ** Remove hardcoded {{REST_SERVER_OPTS}} with {{--add-opens}} (rely on 
{{{}rest_start.py{}}}).
 # Docs
 Document starting rest with:
 {{{}docker compose -f docker-compose.atlas-common.yml -f 
docker-compose.atlas-rest.yml up -d{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to