Opened 7 years ago

Last modified 7 years ago

#1601 closed defect

Petascope_Error with loading GDAL native library when redeploying web application to Tomcat — at Initial Version

Reported by: Bang Pham Huu Owned by: bpham
Priority: major Milestone: 9.5
Component: petascope Version: development
Keywords: gdal native, jni, shared library Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

From version 9.5, Petascope uses GDAL native library (gdal_java package, path in Centos 7: /usr/lib/java/gdal) and this must be loaded to JVM (Tomcat) by Classloader manually. However, when registering the GDAL native library once time when installing new Petascope, it does not allow to add this native library when rasdaman.war is redeployed, then, new Petascope cannot start without restarting Tomcat.

It cannot be solved easily by checking if gdal native library is loaded as it will have another error which is it cannot link the shared library (libgdaljni.so).

This is a problem with Java JNI Classloader and no fix for it. I found a workaround on the Internet which will resolve the problem by doing a trick.

As Classloader will need the full path to gdal native library (/usr/lib/java/gdal) so when starting Petascope, it will not use this path to register to Tomcat. Instead, it will copy this folder to /tml/rasdaman/gdal_java/timestamp (size is 440 kb) and register to JVM.

When the application restarts, it will remove the old folder and override the registered path in JVM with the new path, Hence, JVM will not throw an exception when it checks this path is already loaded.

Change History (0)

Note: See TracTickets for help on using tickets.