Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

ketandba (Programmer) (OP)
12 Apr 05 11:05
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
Diancecht (Programmer)
12 Apr 05 11:33
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
ketandba (Programmer) (OP)
12 Apr 05 12:27
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
Diancecht (Programmer)
12 Apr 05 15:05
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
sedj (Programmer)
12 Apr 05 15:31
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
http://www.primrose.org.uk

ketandba (Programmer) (OP)
13 Apr 05 9:40
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
sedj (Programmer)
13 Apr 05 10:23
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
http://www.primrose.org.uk

ketandba (Programmer) (OP)
16 Apr 05 17:28
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
sedj (Programmer)
17 Apr 05 5:18
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
http://www.primrose.org.uk

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close