cancel
Showing results for 
Search instead for 
Did you mean: 

SAP JCO 3 UnsatisfiedLinkError: /Library/Java/Extensions/libsapjco3.jnilib:

Former Member
0 Kudos

Hi i'm building an app using Sap JCo 3 migrating from 2.1.8. I imported the example apps and had problems in eclipse running it. So i dropped the process all together because of past frustrations with jco i didn't have the time or patience. A month or so later I'm trying again, but this time i packaged my app in a jar then ran java -cp /Library/Java/Extensions/sapjco.jar:myapp.jar StepByStepClient.java and it worked from the command line.

I was inspired again. However I wrote a junit test and I still get the same problem (java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path) when running inside eclipse. Despite it being listed in my classpath in eclipse. In fact when i try to add the external jar it fails because its already listed. The native library is in the same folder as sapjco3.jar.

So i went into project properties, libraries and under JRE System Library, i saw a Native Library Location and edited it to add /Library/Java/Extensions and tried to run it again. Now I have different error:

java.lang.UnsatisfiedLinkError: /Library/Java/Extensions/libsapjco3.jnilib:

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1715)

at java.lang.Runtime.loadLibrary0(Runtime.java:823)

at java.lang.System.loadLibrary(System.java:1030)

at com.sap.conn.jco.rt.DefaultJCoRuntime.loadLibrary(DefaultJCoRuntime.java:423)

at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:292)

at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:862)

at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:947)

at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:41)

at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:213)

at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:186)

at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:77)

at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)

at com.sap.conn.jco.rt.RuntimeEnvironment.setDestinationDataProvider(RuntimeEnvironment.java:117)

at com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(Environment.java:174)......

Any advice would be appreciated.

Thanks in advance.

Joe

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

looks like the JVM cannot find the native library used (sapjco3.dll on windows), put this one on the java.library.path

regards franz

close thread if message is answered

Former Member
0 Kudos

Thanks. I should have pointed out that I'm running mac os x 10.5.5.

And I have in /Library/Java/Extensions/ (which is in java.library.path)

libsapjco3.jnilib sapjco3.jar

Also, when i run it from the command line it works fine, however when running from eclipse it fails. So i guess more specifically this is a question on using Eclipse with JCO3 on Mac.

Thanks again,

Joe

Former Member
0 Kudos

Hello,

maybe eclipse changes the library path

ouput the system property java.library.path in your program and see how it is set

regards franz

Former Member
0 Kudos

when i output it, it displays the folder of that the jco is installed in. It can find the file, but i just get the error mentioned above.

Former Member
0 Kudos

Hello,

no mac os there should be a program called fs_usage (command line) - can´t tell you the excat usage but it should show you which files the system tries to open

start fs_usage and your program and try to find out where it want´s to open the native lib

regards franz