Error getting the version of the native layer: java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path

馋奶兔 提交于 2019-12-24 15:14:32

问题


In my java web application, trying to connect SAP Server. This error is generated. I have placed the sapjco3.dll and sapjco3.jar in WEB-INF/lib/ and also configured in the Java Build Path. I have also set the Path in servlet as

System.setProperty("java.library.path", "/WEB-INF/lib");

But also error existing.


回答1:


There are several issues in your approach

  1. It is not recommended to change java.library.path programmatically, since the property is cached at the JVM start. See Setting "java.library.path" programmatically for more details.

  2. You are overwriting java.library.path instead of adding your directory at the end. It's very likely your application server needs some native libraries of its own.

  3. /WEB-INF/lib is a relative path which your JVM is not going to find as the JVM root directory is different from your app root directory (not to mention if you are deploying a WAR file)

In general, you should configure your SAP JCo as a server library, not an application library. The exact procedure depends of your application server.




回答2:


If you are on Windows like me you can put the sapjco3.dll anywhere you want in the file system (except for the Windows system32 and sysWOW64 directories, as stated in the sapjco3 documentation) and then add the path to it to your Path system variable:

On Linux you add the path to the libsapjco3.so file to the environment variable LD_LIBRARY_PATH

If you are on JBoss and need to get sapjco3.jar into you project see my answer over here: https://stackoverflow.com/a/21901220/1592796



来源:https://stackoverflow.com/questions/16353128/error-getting-the-version-of-the-native-layer-java-lang-unsatisfiedlinkerror-n

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!