node-java icon indicating copy to clipboard operation
node-java copied to clipboard

Error during initialization of VM: alpine3.7.

Open mhtsharma948 opened this issue 6 years ago • 1 comments

My base image in docker container is alpine and I've installed openJDK java1.7. When I run node-java app, it throws the following error:

Error occurred during initialization of VM Unable to load native library: Error relocating /usr/lib/jvm/java-1.7-openjdk/jre/lib/amd64/libjava.so: JVM_FreeMemory: symbol not found

Below in my Dockerfile

FROM microsoft/dotnet:2.1-runtime-alpine3.7

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
 RUN { \
         echo '#!/bin/sh'; \
         echo 'set -e'; \
         echo; \
         echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
     } > /usr/local/bin/docker-java-home \
     && chmod +x /usr/local/bin/docker-java-home
 ENV JAVA_HOME /usr/lib/jvm/java-1.7-openjdk
 ENV PATH $PATH:/usr/lib/jvm/java-1.7-openjdk/jre/bin:/usr/lib/jvm/java-1.7-openjdk/bin
 ENV JAVA_VERSION 7u181
 ENV JAVA_ALPINE_VERSION 7.181.2.6.14-r0
 ENV _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true

 RUN set -x \
     && apk add \
         openjdk7="$JAVA_ALPINE_VERSION" \
     && [ "$JAVA_HOME" = "$(docker-java-home)" ]

RUN apk update && apk upgrade \
    && apk add nodejs \
    && apk add python \
    && apk add fontconfig \
    && apk add build-base  \
    && apk add bash \
    && apk add make \
    && rm -rf /var/cache/apk/* \
    && npm install \
    && npm install -g --quiet gulp-cli pm2 \
    && npm cache clean --force \
    && apk del python \
    && apk del build-base

COPY gulpfile.js ./

COPY tsconfig.json ./

COPY src ./src

COPY config ./config

RUN gulp build 

RUN rm -rf ./src && rm gulpfile.js && rm tsconfig.json

EXPOSE 4000

CMD [ "pm2-runtime" , "./build/server.js" ]

mhtsharma948 avatar Oct 25 '18 13:10 mhtsharma948

Have you ever deal this problem? I met it too.

s-khaon avatar Jan 08 '19 03:01 s-khaon