Indri库java.lang.UnsatisfiedLinkError..change仅交给服务器上的java.lang.NoClassDefFoundError [英] Indri library java.lang.UnsatisfiedLinkError..change to java.lang.NoClassDefFoundError only on the server

查看:261
本文介绍了Indri库java.lang.UnsatisfiedLinkError..change仅交给服务器上的java.lang.NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个Web应用程序,我在其中使用indri.jar。我正在使用eclipse。



我把它放在lib文件夹中,并且添加到构建路径选项。



同样在构建路径 - >配置 - >订单和导出中,将检查所有内容。



同样在属性 - >部署程序集中,添加了所有的jar文件。然后将项目导出到.war并将其放在服务器上。



我检查了部署项目的lib文件夹,并且jar文件在那里。



我的机器和服务器都是64位,因为对于这个库,有两个版本的32位和64位,它不会工作,如果你使用它们而不是每个其他。



同样重要的是说我们是使用git仓库工作的这个项目的团队,而当另一方提取代码时,所有的库都会附带,他们运行代码没有问题。 (他们已经安装了indri,我没有安装在服务器上)



仍然在浏览器中打开页面时,它会给我ajax调用中的错误我追踪到它给我的错误:

 描述服务器遇到内部错误()阻止它执行此请求。 


异常

javax.servlet.ServletException:org.glassfish.jersey.server.ContainerException:java.lang.UnsatisfiedLinkError:no indri_jni in java.library。 pathorg.etc。


根本原因

org.glassfish.jersey.server.ContainerException:java.lang.UnsatisfiedLinkError:no indri_jni in java.library.pathorg.glassfish.etc


根本原因

java.lang.UnsatisfiedLinkError:no indri_jni在java.library.pathjava.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)java .lang.Runtime.loadLibrary0.etc。

我搜索了很多,然后在服务器上运行了这一行:

  java -Djava.library.path = / path / to / jnilib / directory MainClass 

然后错误更改为:

  exception 

javax.servlet.ServletException:org.glassfish.jersey.server.ContainerException:java.lang.NoClassDefFoundError:无法初始化类lemurproject.indri.indriJNIorg.glassfish

根本原因

org.glassfish.jersey.server.ContainerException:java.lang.NoClassDefFoundError:无法初始化类lemurproject.indri.indriJNIorg.glassfish.jersey.servlet

java.lang.NoClassDefFoundError:Could不初始化类lemurproject.indri.indriJNIlemurproject.indri.QueryEnvironment。< init>(QueryEnvironment.java:39)LogicLayer.IndriIndex.processQuery(I ...

注意:


  1. Indri正在服务器上的命令行工作,所以问题不在于indri,而是在部署中。


  2. 当我通过评论与Indri相关的行来部署代码时,它显示我是导出到.war正确。



解决方案

安装是libinrdi_jni.so,它具有将java链接到c语言的作用,该语言是库已经写入的语言。它位于indri安装程序:./install/lib/libindri_jni.so。



我的代码找不到此文件。所以我不得不把它放在服务器的某个地方,它肯定会调查出来,然后找到它,一切正常。



确保你有这个文件您需要以这种方式安装indri:



./ configure --enable-java --with-javahome = address / to // jdk1.7.0 --prefix = /address/to/indri-5.7/install



make all install



确保下载jdk1。 7并自己提取,而不是使用任何安装包。这样将会安装libindri_jni.so。



然后为了确保您的java程序能正常工作,您需要运行IndexUI.jar和RetUI.jar在indri文件夹。如果它有效,那么你的程序也可以工作,但是如果它不起作用,那么尝试运行这个命令:



export LD_LIBRARY_PATH = / address / to / indri-5.7 / install / lib



然后再次运行jar文件,如果问题已经解决,libindri_jni.so文件是问题,你可以通过找到它来解决它一个程序肯定可以找到的地方。


I have this web application where I use the indri.jar in it. I am using eclipse.

I have put it in the lib folder and did "add to build path" option.

Also in "Build Path -> Configure -> Order and Export", everything is checked.

Also in "Properties -> Deployment assembly", all the jar files are added. Then I export the project to .war and put it on the server.

I checked the lib folder of the deployed project and the jar file is there.

Also my machine and server are both 64 bit, since for this library there are two versions for 32 and 64 bit, and it wont work if you use them instead of each other.

It is also important to say that we are a team working on this project using git repository, and when the other side pull the code all the libraries and everything is attached and they have no problem running the code. (They have installed indri, and I did install it on the server)

Still when I open the page in the browser it gives me "error in ajax call" and when I trace the error it gives me:

description The server encountered an internal error () that prevented it from fulfilling    this request.


exception

javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.UnsatisfiedLinkError: no indri_jni in java.library.pathorg.etc.


root cause

org.glassfish.jersey.server.ContainerException: java.lang.UnsatisfiedLinkError: no indri_jni in java.library.pathorg.glassfish.etc


root cause

java.lang.UnsatisfiedLinkError: no indri_jni in java.library.pathjava.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)java.lang.Runtime.loadLibrary0.etc.

I searched a lot and then I ran this line on the server:

java -Djava.library.path=/path/to/jnilib/directory MainClass

Then the error changed to this:

exception

javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class lemurproject.indri.indriJNIorg.glassfish

root cause

org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class lemurproject.indri.indriJNIorg.glassfish.jersey.servlet

java.lang.NoClassDefFoundError: Could not initialize class lemurproject.indri.indriJNIlemurproject.indri.QueryEnvironment.<init>(QueryEnvironment.java:39)LogicLayer.IndriIndex.processQuery(I...

Note:

  1. Indri is working on command line on the server, so the problem is not with indri but is with deploying.

  2. When I deploy the code by commenting the lines related to Indri, it works, that shows I am exporting to .war correctly.

解决方案

There is an important file in indri installation which is libinrdi_jni.so, which has the role of linking java to c language which is the language the library has been written to. It is located in the indri installation foler: ./install/lib/libindri_jni.so.

My code couldn't find this file. So I had to put it somewhere in the server that it will definitely look into and then it did find it and everything worked.

To make sure that you will have this file you need to install indri in this way:

./configure --enable-java --with-javahome=address/to//jdk1.7.0 --prefix=/address/to/indri-5.7/install

make all install

make sure to download the jdk1.7 and extract it yourself instead of using any install package. This way the libindri_jni.so will be installed.

Then to make sure that your java program will work, you need to run IndexUI.jar, and RetUI.jar, provided in the indri folder. If it works, then your program will work too, but if it is not working, then try running this command:

export LD_LIBRARY_PATH=/address/to/indri-5.7/install/lib

then run the jar file again, if the problem has been resolved, the libindri_jni.so file is the problem and you can solve it by locate it in a place that program can definitely find it.

这篇关于Indri库java.lang.UnsatisfiedLinkError..change仅交给服务器上的java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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