native libraries with Java?

52 views
Skip to first unread message

Dane Wallinga

unread,
Aug 19, 2019, 12:58:29 PM8/19/19
to Google App Engine
Hey all,

So I'm working on a small app in Java that makes use of Google OR-Tools. I'd like to host this on App Engine, but there's a native component to the OR tools, and I'm not clear on how / if this is something that App Engine can support. The description of the flexible environment makes reference to supporting apps that depend on native code, but I can't otherwise find any documentation on how that actually works.

So can App Engine support what I'm trying to do, and if so, can someone point my in the right direction of how to do it?

Thanks :-)

George (Cloud Platform Support)

unread,
Aug 19, 2019, 4:45:21 PM8/19/19
to Google App Engine
Hello Dane, 

You may try using a Flexible Environment Custom Runtime, and its Dockerfile to configure the environment and install OR-Tools. Success in installing OR-Tools depends on Dockerfile's own capabilities, as described on its documentation page. You may check related page Installing OR-Tools Java from Source on Linux

Dane Wallinga

unread,
Aug 25, 2019, 7:14:39 PM8/25/19
to Google App Engine
Thanks! So I've written my Dockerfile as follows:

FROM jetty:9.4.18-jre11
WORKDIR $JETTY_BASE

RUN tar -xvf or-tools.tar.gz

ADD generate-program-0.1.0-SNAPSHOT.war $JETTY_BASE/webapps/root.war

RUN java -Djava.library.path=$JETTY_BASE/or-tools_Ubuntu-16.04-64bit_v7.3.7083/lib -jar $JETTY_HOME/start.jar --approve-all-licenses --create-startd --add-to-start=jmx,stats,hawtio && chown -R jetty:jetty $JETTY_BASE

But when I go to my servlet, I get the error:

java.lang.UnsatisfiedLinkError: no jniortools in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]

For some reason the -Djava.libary.path flag doesn't seem to be working? I've ssh-ed into the container, and the or-tools are extracted in the expected location, so the path I'm specifying exists. Any idea what I'm doing wrong here?

Thanks

Diogo Almeida

unread,
Aug 25, 2019, 9:56:16 PM8/25/19
to Google App Engine
It seems your Dockerfile is having issues to find the library in the path specified. Take a look at this Stack Overflow thread with a suggestion on how to resolve this error.
Reply all
Reply to author
Forward
0 new messages