1

I am trying to run the JIB plugin using below configuration in pom.xml

<configuration>
  <from>
     <image>{artifactory-location}/container-release/managedbaseimages/oracle-jdk:11-stable</image>
  </from>
  <to>
    <image>{artifactory-location}/container-sandbox/abc/bot-sample-image</image>
  </to>
  <container>
    <creationTime>${maven.build.timestamp}</creationTime>                           
    <jvmFlags>
      <jvmFlag>-Djava.library.path=.</jvmFlag>
      <jvmFlag>-Dlog4j2.configurationFile=log4j2_default.xml</jvmFlag>
    </jvmFlags>
<!--<args>-->
<!--  <arg>-Djava.library.path</arg>-->
<!--  <arg>.</arg>-->
<!--</args>-->
  </container>
</configuration>

When I try to docker run the image I face below error, although the jni.so file is present in the folder (I tried to give different folder locations as well):

ERROR StatusLogger Reconfiguration failed: No configuration found for '4b85612c' at 'null' in 'null'
22:02:21.085 [main] ERROR TRACE.Casp - no casp_jni in java.library.path: [.]
java.lang.UnsatisfiedLinkError: no casp_jni in java.library.path: [.]
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660) ~[?:?]
        at java.lang.Runtime.loadLibrary0(Runtime.java:827) ~[?:?]
        at java.lang.System.loadLibrary(System.java:1871) ~[?:?]

The application runs fine it I run using:

java -Djava.library.path=. -jar bot_sample.jar

The Container entrypoint set to [java, -Djava.library.path=., -Dlog4j2.configurationFile=., -cp, /app/resources:/app/classes:/app/libs/*, com.abc.def.bot.Main]

1 Answers1

0

I was able to solve this by changing the base image to: container-release/managedbaseimages/openjdk/jre:11-stable

and copying the .so file from my local to /usr/lib using:

<extraDirectories>
                            <paths>
                                
                                <path>src/main/java/native</path>
                                <path>
                                    <from>src/main/java/native</from>
                                    <into>/usr/lib</into>
                                </path>
                            </paths>

</extraDirectories>