Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unsatisfied link error

Status
Not open for further replies.

ketandba

Programmer
Nov 15, 2004
38
US
hi,
i am developing web application using java.
i am using ant builder for build the java project.
i am creating .ear file through ant build.xml and deploy this .ear file on jboss application server.
for running some java program i have to use shared library...so at run time i have to pass
java.library.path = path/of/shared/lib/libdb_java-4.3.so
this libdb_java-4.3.so is shared library and it resides on linux server where jboss is installed.

when end-user running this application through browser(from windows operating system), how pass the
java -Djava.library.path for getting shared library...

otherwise program terminated with
Exception in thread "main" java.lang.UnsatisfiedLinkError: no db_java-4.3 in java.library.path

while generating .ear file through ant builder..
i am just compile the classs which includes .jar file in classpath.

if i run the program on linux server by giving command
java -Djava.library.path=path/of/shared lib/libdb_java-4.3.so programName.class it works
perfectly.....

pl. guide me...
Thanks in advanced..

ketan
 
Yum yum.

Maybe I'm wrong. but if it's a web application, the end user will see html/Javascript, so no need od a shared library.

If that exception is thrown at client side, I assume you're using an applet or something similar. If so, your applet needs to be sgined to access local resuorces as shared libraries and those libraries needs to be installed on the client machine.

Cheers,

Dian
 
hi,
Dian,
Thanks for replay..
you are right ..i am using servlet...
But it is not practically possible to put this shared library on every user computer...because for web application, user can access the application worldwide..

pl. give other solution..

ketan
 
Yum yum.

A servlet is executed at server side.
An applet is executed al client side.

You first need to know what are you using and understand how it works.

If yuu're using servlets, then the exception is thrown at server-side (the Jboss server). If so, it's a JBoss configuration problem.

Cheers,

Dian
 
Basically, if the Java code that requires the .so lib via JNI is running on the server in JBoss, just make sure that the LD_LIBRARY_PATH env var on the user running JBoss is set to include your .so.

If you are running an applet, that requires this JNI .so then you MUST also have the client download this. And if they are running Windows - then you will need a DLL, not a linux shared object.

Perhaps you should be a little bit more specific about the things that matter. Whether or not you are using ant as a build tool is not really relevant !

--------------------------------------------------
Free Database Connection Pooling Software
 
hi,
dian & sedj

Thanks for repaly..

I am sure that i am using servlet, so this exception thrown by server side.

i have to set somthing on jboss server.
As per my knowledge, i have to change run.sh for jboss.
make change such that while executing java programm it directly take -Djava.library.path settings.

here is the snipet of my run.sh
# Setup the JVM
if [ "x$JAVA" = "x" ]; then
if [ "x$JAVA_HOME" != "x" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="java"
fi
fi

# Setup the classpath
runjar="$JBOSS_HOME/bin/run.jar"
if [ ! -f $runjar ]; then
die "Missing required file: $runjar"
fi
JBOSS_BOOT_CLASSPATH="$runjar"
.....
....
....
# Setup JBoss sepecific properties
JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME"
....
..
do
# Execute the JVM
"$JAVA" $JAVA_OPTS \
-classpath "$JBOSS_CLASSPATH" \
org.jboss.Main "$@"
STATUS=$?
done

....

*************
if my assumption is true then i have to put this question in jboss forum..

Thanks and your help is appriciated...

ketan
 
As I said before, just add your programme directory to the env var LD_LIBRARY_PATH in JBoss run.sh or in the user's ~/.profile .

Or, just copy your .so file to /usr/lib - and it will be added automatically.

--------------------------------------------------
Free Database Connection Pooling Software
 
hi,
sedj,
Thanks for replay...
i have added LD_LIBRARY_PATH=actual/path/of/.so
also put .so file in /usr/lib dir
and restart the jboss server and try to execute the web application ...but it give me the same error

java.lang.UnsatisfiedLinkError: no db_java-4.3 in java.library.path

pl. help me out...

ketan
 
Perhaps you are loading the lib incorrectly ...

If your .so is called "libserver.so" then you should load it thus :

static {
System.loadLibrary("server");
}

You should also make sure that you compile the .so with the "-shared" option if using GCC.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top