cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime Error No sapjco3 in java library path.

shankar_agarwal
Contributor
0 Kudos

Hi All

i am getting following error when i am trying to test sample sapjco 3 tutorial stepbystepclient.java.

i have already added sapjco3.jar as external jars as well as in the the project folder as internal jars.


*java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path*
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
	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:425
)
	at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntim
e.java:293)
	at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:891)
	at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:948)
	at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:
41)
	at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:253)
	at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:195)
	at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:74)
	at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at com.sap.conn.jco.JCo.createJCo(JCo.java:51)
	at com.sap.conn.jco.JCo.<clinit>(JCo.java:25)
	at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.
java:61)
	at src.sampleJCO.step1Connect(sampleJCO.java:84)
	at src.sampleJCO.main(sampleJCO.java:314)
Exception in thread "main" java.lang.ExceptionInInitializerError: Error getting 
the version of the native layer: java.lang.UnsatisfiedLinkError: com.sap.conn.rf
c.driver.CpicDriver.nativeCpicGetVersion([I)I
	at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:207)
	at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:74)
	at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at com.sap.conn.jco.JCo.createJCo(JCo.java:51)
	at com.sap.conn.jco.JCo.<clinit>(JCo.java:25)
	at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.
java:61)
	at src.sampleJCO.step1Connect(sampleJCO.java:84)
	at src.sampleJCO.main(sampleJCO.java:314)

I am quite new to java development in SAP.Is it ok to have commonly used application being developed using SAPJCO?

Regards

Shankar

Edited by: Shankar on Sep 16, 2009 5:40 PM

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

As others have noted, this crops up in Google search, so I thought I would add my issues and resolution to try to assist others.

The sapjco3.jar file needs to be added to your project as a Referenced Library Dependency in order to use its functionality. On Windows, this .jar file is dependent on the sapjco3.dll file that is delivered with it. The exceptions above come from an inability to locate the .dll file. In addition, the .jar file is dependent on having the correct version of the .dll (which means installing it on the system library path could cause compatability issues for those with multiple versions of JCo active).

If you download the most recent JCo package and use it in your projects, I believe the .dll and the .jar are delivered in the same directory, which probably eliminates this issue. In my case, I have an older project that was not set up that way, and I didn't want to risk the regressions that could come from introducing a new code base to the solution. Here's what I did in Eclipse (I am using Mars)

  • Locate the correct sapjco3.dll file.
  • Go to the Java perspective and open the Package Explorer view.
  • Expand Referenced Libraries. You should see your sapjco3.jar file there. Right click on it and select Build Path/Configure Build Path
  • Click on the Libraries tab. Expand the sapjco3.jar. Under this, you will see an option called Native library location (and probably (None) selected). Select this option and click the Edit button.
  • Navigate to the location of the sapjco3.dll file you found earlier. Click OK to accept it, then Apply and OK to use it.

This resolved my problem, and should resolve any problems related to a missing .dll in your Eclipse projects.

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mike,

just for your information:

If you would like to know how the JCo JNI library loading mechanism works in detail, please have a look into the packaged JCo documentation at chapter "Configuration".

This can be found in the file javadoc\useful.html.

Best regards,

Stefan

Former Member
Former Member
0 Kudos

This thread is ancient but it crops up in all google searches so I thought I would post a solution anyway.

I had exactly the same problem and tried all of the above without success.  The solution in my case was to make sure the JVM and sapjco3.dll were the for the same platform.  I had the 64 bit JCO3 running with 32 bit JVM.  I changed and installed the 32 bit JCO3 version.

Go to Start>Control Panel>Java to check JVM version.

If that doesn't work try these:

1. JCO 3 problems with Library - UnsatisfiedLinkError [SOLVED] - Toolbox for IT Groups

2. https://scn.sap.com/thread/11967

3. Error: sapJco3 load the Java library

Former Member
0 Kudos

Thank you,

this helped me. Do not copy the library from maschine to maschine just because you are too lazy to download the correct one.

Former Member
0 Kudos

Hi Shankar,

     Have you dealed with your problems,I can use java throw jco connect to sap rfc,but when i use jsp call the object's method , then report erro as following:

java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path

          at java.lang.ClassLoader.loadLibrary(Unknown Source)

          at java.lang.Runtime.loadLibrary0(Unknown Source)

          at java.lang.System.loadLibrary(Unknown Source)

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

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

          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:73)

          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)

          at omec.com.sap.tools.ERPConnection.<init>(ERPConnection.java:26)

          at omec.com.sap.tools.ERPImpStruct.ConnectERP(ERPImpStruct.java:69)

          at omec.com.servlet.ScancodeServlet.doPost(ScancodeServlet.java:45)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)

          at java.lang.Thread.run(Unknown Source)

Attributes:

Attributes:

2013-1-4 10:46:21 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet ScanServlet threw exception

java.lang.NoClassDefFoundError: com.sap.conn.rfc.driver.CpicDriver

          at com.sap.conn.rfc.engine.DefaultRfcRuntime.createChannel(DefaultRfcRuntime.java:52)

          at com.sap.conn.rfc.engine.RfcIoOpenCntl.open_channel(RfcIoOpenCntl.java:1260)

          at com.sap.conn.rfc.engine.RfcIoControl.ab_rfcopen(RfcIoControl.java:85)

          at com.sap.conn.rfc.api.RfcApi.RfcOpen(RfcApi.java:83)

          at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1107)

          at com.sap.conn.jco.rt.ClientConnection.connect(ClientConnection.java:659)

          at com.sap.conn.jco.rt.PoolingFactory.init(PoolingFactory.java:103)

          at com.sap.conn.jco.rt.ConnectionManager.createFactory(ConnectionManager.java:171)

          at com.sap.conn.jco.rt.DefaultConnectionManager.createFactory(DefaultConnectionManager.java:44)

          at com.sap.conn.jco.rt.ConnectionManager.getFactory(ConnectionManager.java:160)

          at com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:754)

          at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:615)

          at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:26)

          at omec.com.sap.tools.ERPConnection.<init>(ERPConnection.java:30)

          at omec.com.sap.tools.ERPImpStruct.ConnectERP(ERPImpStruct.java:69)

          at omec.com.servlet.ScancodeServlet.doPost(ScancodeServlet.java:45)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)

          at java.lang.Thread.run(Unknown Source)


Former Member
0 Kudos

Or check this link: [SAP note 684106|https://service.sap.com/sap/support/notes/684106]

Former Member
0 Kudos

Check this [link|http://sap.ittoolbox.com/groups/technical-functional/sap-interfaces/jco-3-problems-with-library-unsatisfiedlinkerror-3229226] - it mentions that Microsoft VC++ Redistributable needs to be updated.

Former Member
0 Kudos

Hi Shankar,

This will be mostly the rfc.dll need to placed with the new one downloaded from the service market place.

Please follow these steps given in the link

http://publib.boulder.ibm.com/infocenter/wbihelp/v6rxmx/index.jsp?topic=/com.ibm.wbia_adapters.doc/d...

Also make sure you use the correct JDK version

Regards,

Vivek Nidhi

shankar_agarwal
Contributor
0 Kudos

Hi Vivek

i am kind of new to java development here.I will tell you what i am doing.

1>I have downloaded sapjco3.jar from service market place.

2>i have added this as an external jar in the project,i also added it in the project,to avoid any kind of error.

i am using remote SAP WAS.Do i need to make any installation?If yes then please detail

Thanks and regards

Shankar

Former Member
0 Kudos

Hi Shankar,

I guess the step you are missing is there are DLL which need to be in the c:\windows\system32

These 2 are the DLLS (librfc32.dll, sapjcorfc.dll) this will the the zip you downloaded from service market place.

Please do this and let me know

Regards,

Vivek Nidhi

0 Kudos

In linux which are the .so files required and where we have to copy the .so files

we are using sapjco3.jar in linux server we are able to connect to sap but files are not downloading.