在Tomcat中找不到本机库 [英] Native libraries not found in Tomcat

查看:214
本文介绍了在Tomcat中找不到本机库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个GWT应用程序,其中包含一些带有JNI的本地库。当我从eclipse测试它时,一切正常,但是当我尝试将它部署到Eclipse服务器上时,它找不到本地库。



我跟着本教程适用于JNI和Tomcat



<但它仍然找不到我注意到的。当我从服务器端应用程序中读取 java.library.path 时,它与我启动Tomcat时得到的不同(使用

设置路径)。



解决方案最简单的答案可能是编辑Tomcat安装的 bin / startup 脚本来更改 java.library.path 到您将本机库复制到的任何位置。类似于

  java -Djava.library.path = / path / to / my / libs现有参数
code>

如果您使用的是共享托管服务提供商,则需要咨询所有者以确定他们是否允许本地要加载到容器中的库,以及是否应该复制这些库的具体位置。

除此之外,您的开发环境存在不同的元问题来自您的部署环境。理想情况下,您将拥有在本地开发机器上运行的部署配置的精确副本(或尽可能接近)。


I developed an GWT application which includes some native libraries with JNI. when I test it from eclipse everything works fine, but when I try to deploy it on my Eclipse server it can't find the native libraries.

I followed this tutorial for JNI and Tomcat

but it still can't find them I noticed. That when I read the java.library.path from within my serversided application it is different from what I get when I start Tomcat (displaying the path variables with set path).

Any ideas what I am missing?

解决方案

The simplest answer might be to edit your Tomcat installation's bin/startup script to change the java.library.path to wherever you're copying the native library to. Something like

java -Djava.library.path=/path/to/my/libs existing args

If you're using a shared hosting provider, you'll need to consult with the owner to determine if they'll allow native libraries to be loaded into the container, and if there's a specific location to which the libraries should be copied.

Beyond that, there's the meta problem of your development environment being different from your deployment environment. Ideally, you would have an exact copy (or as close as possible) of the deployment configuration running on your local development machine.

这篇关于在Tomcat中找不到本机库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆