Error getting the version of the native layer: jav

2019-08-08 17:45发布

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.

2条回答
时光不老,我们不散
2楼-- · 2019-08-08 17:59

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.

查看更多
Juvenile、少年°
3楼-- · 2019-08-08 18:04

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:

sapjco3.dll in 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

查看更多
登录 后发表回答