本文介绍了获取本机层版本时出错:java.lang.UnsatisfiedLinkError:java.library.path中没有sapjco3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Java Web应用程序中,尝试连接SAP Server.产生此错误.我已经将 sapjco3.dll和sapjco3.jar 放在 WEB-INF/lib/中,并且也在Java Build Path中进行了配置.我还将Servlet中的路径设置为

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");

但是也存在错误.

推荐答案

您的方法有几个问题

  1. 不建议以编程方式更改java.library.path,因为该属性是在JVM启动时缓存的.请参见以编程方式设置"java.library.path" 有关更多详细信息.

  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.

您正在覆盖java.library.path,而不是在末尾添加目录.您的应用服务器很可能需要自己的一些本机库.

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.

/WEB-INF/lib是您的JVM找不到的相对路径,因为JVM根目录不同于您的应用程序根目录(更不用说是否要部署WAR文件了)

/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)

通常,您应该将SAP JCo配置为服务器库,而不是应用程序库.确切的过程取决于您的应用程序服务器.

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

这篇关于获取本机层版本时出错:java.lang.UnsatisfiedLinkError:java.library.path中没有sapjco3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 21:34