2

I make web application in Eclipse using GDAL. In Eclipse in Debug Configurations i add variable path=path/to/gdal/folder. In project i add gdal.jar to build path and copy gdal folder in lib directory. And all works fine. After i export my application to WAR file and want to deploy it in another computer. I download gdal for Win 64bit, put it in tomcat/shared/lib and add it in Win varible PATH.
And get error:

java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.GetDriverCount()I
org.gdal.ogr.ogrJNI.GetDriverCount(Native Method)

What i can do wrong?

UPDATE

In catalina.bat i set set JAVA_OPTS="-Djava.library.path=/tomcat/shared/lib" but its not help me. There i get answer that if i see something like this in errors its mean that library is loaded and problem in library itself.

2

You forgetting to copy the *jni.so files to your shared library folder.

As state on gdal java documentation http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix:

To deploy you need gdal.jar in your class path, the 4 .so files (libgdalconstjni.so, libgdaljni.so, libogrjni.so and libosrjni.so) and libgdal.so in your shared library path.

This should be installed into your application server as an commom library. Not to be packed into the application since those libraries could be used by several applications. I prefer try to load the classes in the application and on failure report the error. Then ask the system administrator to install it.

4
  • How i already write i have Win 64 not Unix system, so i not need in *.so files. Right?
    – Kliver Max
    Dec 25 '12 at 5:19
  • You need the equivalent of those files in Windows. They are *.dll.
    – cavila
    Dec 25 '12 at 10:32
  • I already copy gdal folder in tomcat/shared/lib and add it in Win varible PATH.
    – Kliver Max
    Dec 26 '12 at 6:29
  • I think is not needed to add thsoe directories to the PATH environment variable. You could try inspect Tomcat log files to see if it logged some additional exception details about why it could not lod the library. Also Tomcat is like any other Java application. You can simulate the class loading by creating a simple java program that make a call to a gdal function.
    – cavila
    Dec 26 '12 at 12:05
1

GDAL is a C++ library which offers wrappers for other languages: python, java, etc. So in addition to use the JAR file you need to have the libraries installed on each.

1
  • Yeah i use gdal.jar with another dll files.
    – Kliver Max
    Dec 25 '12 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.