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

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

问题描述

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

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.

我遵循了JNI 和 Tomcat 的本教程

但它仍然找不到我注意到的它们.当我从服务器端应用程序中读取 java.library.path 时,它与我启动 Tomcat 时得到的不同(使用 set path 显示路径变量).

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?

推荐答案

最简单的答案可能是编辑 Tomcat 安装的 bin/startup 脚本以更改 java.library.path 到您要将本机库复制到的任何位置.类似的东西

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天全站免登陆