[gdal-dev] Cannot load Java GDAL native library in web application with error in link library?
ijturton at gmail.com
Tue May 23 06:15:51 PDT 2017
Simply add -Djava.library.path="/usr/lib/java/gdal/" to the Tomcat startup
args in /usr/share/tomcat7/bin/catalina.sh or add /usr/lib/java/gdal/ to
your LD_LIBRARY_PATH (and restart tomcat).
On 23 May 2017 at 14:05, yuchan <a09550 at gmail.com> wrote:
> I'm using GDAL library java as a dependency in Java web application with
> Maven dependency:
> It contains a jar file and runs the native codes in C++ underneath which I
> had to install from packages in Centos. All these shared libraries are
> installed in
> ls -l /usr/lib/java/gdal/
> total 1380
> -rwxr-xr-x 3 root root 23288 Feb 14 2016 libgdalconstjni.so
> -rwxr-xr-x 3 root root 23288 Feb 14 2016 libgdalconstjni.so.1
> -rwxr-xr-x 3 root root 23288 Feb 14 2016 libgdalconstjni.so.1.18.4
> -rwxr-xr-x 3 root root 226696 Feb 14 2016 libgdaljni.so
> -rwxr-xr-x 3 root root 226696 Feb 14 2016 libgdaljni.so.1
> -rwxr-xr-x 3 root root 226696 Feb 14 2016 libgdaljni.so.1.18.4
> -rwxr-xr-x 3 root root 136760 Feb 14 2016 libogrjni.so
> -rwxr-xr-x 3 root root 136760 Feb 14 2016 libogrjni.so.1
> -rwxr-xr-x 3 root root 136760 Feb 14 2016 libogrjni.so.1.18.4
> -rwxr-xr-x 3 root root 73816 Feb 14 2016 libosrjni.so
> -rwxr-xr-x 3 root root 73816 Feb 14 2016 libosrjni.so.1
> -rwxr-xr-x 3 root root 73816 Feb 14 2016 libosrjni.so.1.18.4
> However, the web application cannot link as it has a problem to link
> libraries, although what I can see from class loader of Java is:
> which contains the /usr/lib folder.
> The error from the GDAL java when I invoke a GDAL API (it does not have
> error if I don't invoke GDAL's methods so other methods still work, Web
> application can run normally) is:
> *Caused by: java.lang.UnsatisfiedLinkError:
> at org.gdal.osr.osrJNI.new_SpatialReference__SWIG_1(Native Method)
> at org.gdal.osr.SpatialReference.<init>(SpatialReference.java:117)
> I don't know how to solve this problem, tried to find lots of resources but
> no help as I want to deploy this as a Web application in Tomcat server. I
> could make it work when setting in NetBeans IDE with JVM option
> but I know this is not what web application can run.
> View this message in context: http://osgeo-org.1560.x6.
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev