Search code examples
spring-bootdockersapjco3

Sap Java Connector Application in Docker


I am trying to build a sap java connector using springboot. To build this app we need sapjco3.jar and sapjco3.so.

I am using Hibersap library and have added the maven jar dependencies. In the documentation it says to run the the app we need pass the java.library.path={path to the .so file} in java params.

The application is running fine in linux but I am facing :

Caused by: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: /usr/lib/libsapjco3.so: libuuid.so.1: cannot open shared object file: No such file or directory

when I am trying to run in Docker.

I have added this in my dockerfile. :

VOLUME ["/var/log/hip"]
ADD maven/@file@ app.jar
COPY libsapjco3.so /usr/lib/libsapjco3.so
RUN chmod a+x -R /usr/lib/libsapjco3.so
RUN sh -c 'touch /app.jar'
CMD [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --logging.path=/var/log/hip"]

and I am trying the path using:

System.setProperty("java.library.path","/usr/lib");

As I said, this is working in windows using dll and linux using but it is failing in docker running linux.


Solution

  • I had same problem (WSO2 Docker image and SAP integration), try to install "libuuid" package inside your Docker image. SAP connector was searching for libuuid, so I installed it and it started up. I was using Alpine Linux inside Docker image and this helped:

    apk add libuuid