Start flowable/flowable-rest docker container with custom JARs in classpath

Hi all,

I am attempting to containerize flowable-rest, and I have the following Dockerfile:

FROM flowable/flowable-rest:6.3.1

COPY target/my-classes.jar /
COPY my-bpmn.xml /my-bpmn.xml
COPY docker_setup.sh /docker_setup.sh # this script deploys the BPMN xml copied above
RUN sh docker_setup.sh
ENTRYPOINT [“java”, “-classpath”, “/my-classes.jar”, “-jar”, “/app.war”]

However, when I try to invoke my flow, I get:
{“message”:“Internal server error”,“exception”:“couldn’t instantiate class org.myorg.MyClass”}

Is there some configuration that I am missing? Thanks!

Hi,
unfortunately it’s not that easy to add custom jars to the classpath, since the app is packaged as a war. What you could do is to add your jar to the war file with the following commands:

# Copy the flowable-rest.war to an empty directory
mkdir working-directory
cd working-directory
cp /path/to/flowable-rest.war .

# Copy my-classes.jar to WEB-INF/lib/
mkdir -p WEB-INF/lib/
cp /path/to/my-classes.jar WEB-INF/lib/

# Add the my-classes lib to the war file
jar -uvf0 flowable-rest.war WEB-INF

# Remove the WEB-INF folder (important in case you would like to start it directly without the docker container)
rm -rf WEB-INF

# Start the flowable-rest application (or include it into the docker image)
java -jar flowable-rest.war

Hopefully that works for you,

Valentin

1 Like