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:
Indri is working on command line on the server, so the problem is not with indri but is with deploying.
When I deploy the code by commenting the lines related to Indri, it works, that shows I am exporting to .war correctly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…