One Star

SDI sOGRInput no ogrjni in java.library.path

Hi
I am playing around with TOS and SDI trying to use sOGRInput:
Using a simple shape file and I get the following error
Native library load failed.
java.lang.UnsatisfiedLinkError: no ogrjni in java.library.path
Exception in thread "main" java.lang.Error: java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.RegisterAll()V
Any idea? (TOS 4.2.3 sdi 4.2)
Does using OGR require additional configuration?
What is the GDAL/OGR version included with SDI4.2?
Could the Talend SDI component be configured to use a "standalone" GDAL/OGR deployment (one that is installed independently from Talend SDI?
tx
Luc

9 REPLIES
One Star Fxp
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Hello Luc,
Hi
I am playing around with TOS and SDI trying to use sOGRInput:
Using a simple shape file and I get the following error
Native library load failed.
java.lang.UnsatisfiedLinkError: no ogrjni in java.library.path
Exception in thread "main" java.lang.Error: java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.RegisterAll()V
Any idea? (TOS 4.2.3 sdi 4.2)
Does using OGR require additional configuration?

Before running the job, you need to set the path to GDAL/OGR libs in
'Advanced Settings' of the run job tab, and add JVM settings
-Djava.library.path=/path/to/your/ogr/gdal/gdal-1.8.0/lib/
What is the GDAL/OGR version included with SDI4.2?

None.
Could the Talend SDI component be configured to use a "standalone" GDAL/OGR deployment (one that is installed independently from Talend SDI?

It is. GDAL is not provided in TOS spatial package.
From my side, I've been testing it for Shapefile, PostGIS, WFS, KML, DXF, Oracle on Linux
HTH.
Francois
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Hi Francois
Thanks for your prompt reply.
After adding the Djava.library.path="D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/gdal/java/"
to the advanced settings, the ogrjni.dll is found.
However it complains about the other dependencies not being found now:
Native library load failed.
java.lang.UnsatisfiedLinkError: D:\GdalOgr\release-1600-x64-gdal-1-8-mapserver-6-0\bin\gdal\java\ogrjni.dll: Can't find dependent libraries
Exception in thread "main" java.lang.Error: java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.RegisterAll()V
I have tried to change the Djava.library.path settings in many different ways:
Djava.library.path="D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/gdal/java/;%PATH%"
Djava.library.path="D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/;D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/gdal/java/"
But all with same result.
I assume that the system cannot find the dll which are referred to by the ogrjni.dll, but I hvae no idea which ones these are.
As you can see I am on Windows.
Any other advice you can give me?
Just a general question, is this documented somewhere? I just want to double check I have not overlooked possible information sources before bothering.
Thanks again
Luc
One Star Fxp
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Hello Luc,
Check that your GDAL/OGR is build with Java. All information I've been using for testing are available here :
http://trac.osgeo.org/gdal/wiki/GdalOgrInJava
HTH.
Francois
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Thansk Francois
I just have it working, forgot that all my GDAL/OGR parameters are always in my batch file. Have updated the system variables accordingly and seems to work now.
tx
Luc
One Star Fxp
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

That's great, Luc. Could you post what are the changes you made ? so we could make an how-to on the wiki about how to use sOgrInput component on Linux or Windows.
Thanks for sharing.
Best.
Francois
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Bonjour Francois

I have taken these from the sdkshell.bat file under the root of the GDAL/OGR files.
SET PATH=%CD%\bin;%CD%\bin;%CD%\bin\gdal\python\osgeo;%CD%\bin\proj\apps;%CD%\bin\gdal\apps;%CD%\bin\ms\apps;%CD%\bin\gdal\csharp;%CD%\bin\ms\csharp;%CD%\bin\curl;%PATH%
SET GDAL_DATA=%CD%\bin\gdal-data
SET GDAL_DRIVER_PATH=%CD%\bin\gdal\plugins
SET PYTHONPATH=%CD%\bin\gdal\python\osgeo
SET PROJ_LIB=%CD%\bin\proj\SHARE
I am not sure if all these are required, could not find immediat more info on the gdal website, but never the less I these always have these in place.
So by creating a user or system environment variable for each of them helped me to get the OGR working.
1. is to add the followings paths to the existing PATH environment variable:
------------------------------------------------------------------------------------------
Path_to_Gdal_install\bin;Path_to_Gdal_install\bin;Path_to_Gdal_install\bin\gdal\python\osgeo;Path_to_Gdal_install\bin\proj\apps;Path_to_Gdal_install\bin\gdal\apps;Path_to_Gdal_install\bin\ms\apps;Path_to_Gdal_install\bin\gdal\csharp;Path_to_Gdal_install\bin\ms\csharp;Path_to_Gdal_install\bin\curl;
2. create a new environment variable GDAL_DATA:
------------------------------------------------------------
value: Path_to_Gdal_install\bin\gdal-data
3. create a new environment variable GDAL_DRIVER_PATH:
------------------------------------------------------------
value: Path_to_Gdal_install\bin\gdal\plugins

4. create a new environment variable PROJ_LIB:
------------------------------------------------------------
value: Path_to_Gdal_install\bin\proj\SHARE
5. create a new environment variable PYTHONPATH:
------------------------------------------------------------
value: Path_to_Gdal_install\bin\gdal\python\osgeo

And additionally, as you already explained in your first reply:
In 'Advanced Settings' of the run job tab, and add JVM settings
-Djava.library.path="Path_to_Gdal_install/bin/gdal/java;"
for example:
Djava.library.path="D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/gdal/java;"
I hope this helps.
Regards
Luc
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Hello,
Thanks to Luc and fx I find a way to setup GDAL lib in Talend. I will add all documentation I wrote in the github repository this afternoon.
@Luc: add "Djava.library.path="D:/GdalOgr/release-1600-x64-gdal-1-8-mapserver-6-0/bin/gdal/java;"" was not useful for me, are you sure you need it?
Y.
One Star

Re: SDI sOGRInput no ogrjni in java.library.path

One Star

Re: SDI sOGRInput no ogrjni in java.library.path

Plz give me detail instruction to set to path