Errors running user jars with flink in docker flink x

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Errors running user jars with flink in docker flink x

Paroma Sengupta
Hi,
I am trying to run my flink application through docker containers. For that I made use of the code present over here flink_docker. However when I try to run the docker image, it fails with this error message ```WARN org.apache.flink.client.cli.CliFrontend - Could not load CLI class org.apache.flink.yarn.cli.FlinkYarnSessionCli.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLine(CliFrontend.java:1238)
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLines(CliFrontend.java:1183)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1109)
Caused by: java.lang.NoSuchFieldError: MODE
at org.apache.flink.yarn.cli.FlinkYarnSessionCli.<init>(FlinkYarnSessionCli.java:185)
at org.apache.flink.yarn.cli.FlinkYarnSessionCli.<init>(FlinkYarnSessionCli.java:172)
... 7 more
Exception in thread "main" java.lang.NoSuchFieldError: MODE
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLines(CliFrontend.java:1192)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1109)```

Any pointers for solving this issue will be thoroughly appreciated.

Sincerely,
Paroma
Reply | Threaded
Open this post in threaded view
|

Errors running user jars with flink in docker flink x

Paroma Sengupta

Hi,
I am trying to run my flink application through docker containers. For that I made use of the code present over here flink_docker. However when I try to run the docker image, it fails with this error message
 
```WARN org.apache.flink.client.cli.CliFrontend - Could not load CLI class org.apache.flink.yarn.cli.FlinkYarnSessionCli.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLine(CliFrontend.java:1238)
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLines(CliFrontend.java:1183)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1109)
Caused by: java.lang.NoSuchFieldError: MODE
at org.apache.flink.yarn.cli.FlinkYarnSessionCli.<init>(FlinkYarnSessionCli.java:185)
at org.apache.flink.yarn.cli.FlinkYarnSessionCli.<init>(FlinkYarnSessionCli.java:172)
... 7 more
Exception in thread "main" java.lang.NoSuchFieldError: MODE
at org.apache.flink.client.cli.CliFrontend.loadCustomCommandLines(CliFrontend.java:1192)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1109)```

Any pointers for solving this issue will be thoroughly appreciated.

the Docker file has the following contents:

FROM java:8-jre-alpine

# Install requirements
RUN apk add --no-cache bash snappy

# Flink environment variables
ENV FLINK_INSTALL_PATH=/opt
ENV FLINK_HOME $FLINK_INSTALL_PATH/flink
ENV FLINK_LIB_DIR $FLINK_HOME/lib
ENV PATH $PATH:$FLINK_HOME/bin

# flink-dist can point to a directory or a tarball on the local system
ARG flink_dist=NOT_SET
ARG job_jar=NOT_SET

# Install build dependencies and flink
ADD $flink_dist $FLINK_INSTALL_PATH
ADD $job_jar $FLINK_INSTALL_PATH/job.jar

RUN set -x && \
  ln -s $FLINK_INSTALL_PATH/flink-* $FLINK_HOME && \
  ln -s $FLINK_INSTALL_PATH/job.jar $FLINK_LIB_DIR && \
  addgroup -S flink && adduser -D -S -H -G flink -h $FLINK_HOME flink && \
  chown -R flink:flink $FLINK_INSTALL_PATH/flink-* && \
  chown -h flink:flink $FLINK_HOME

COPY docker-entrypoint.sh /

USER flink
EXPOSE 8081 6123
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["--help"]

The contents of the docker-entrypoint.sh:
### If unspecified, the hostname of the container is taken as the JobManager address
FLINK_HOME=${FLINK_HOME:-"/opt/flink/bin"}
#FLINK_INSTALL_PATH=${FLINK_INSTALL_PATH:-"/opt"}

JOB_CLUSTER="job-cluster"
TASK_MANAGER="task-manager"
RUN_FATJAR="run-fatJar"
CMD="$1"
FATJAR="$2"
shift;

if [ "${CMD}" == "--help" -o "${CMD}" == "-h" ]; then
    echo "Usage: $(basename $0) (${JOB_CLUSTER}|${TASK_MANAGER}|${RUN_FATJAR})"
    
elif [ "${CMD}" == "${JOB_CLUSTER}" -o "${CMD}" == "${TASK_MANAGER}" -o "${CMD}" == "${RUN_FATJAR}" ]; then
    echo "Starting the ${CMD}"

    if [ "${CMD}" == "${TASK_MANAGER}" ]; then
        exec $FLINK_HOME/bin/taskmanager.sh start-foreground "$@"
    elif [ "${CMD}" == "${RUN_FATJAR}" ]; then
    echo "Starting fatJar at $FLINK_HOME/lib"
    exec $FLINK_HOME/bin/flink run $FLINK_HOME/lib
    else
        exec $FLINK_HOME/bin/standalone-job.sh start-foreground "$@"
    fi
else
echo  "flink home ${FLINK_HOME}"
echo "the command ${CMD} does not exist"
fi

#exec "$@"
The command I am running is:
docker run <image-name> run-fatJar


 

Sincerely,
Paroma