You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ma...@optonline.net on 2003/07/05 02:25:00 UTC

JNI with Servlets

I'm attempting to use a shared library on Linux thats called from a servlet that I have deployed on Tomcat 4.1.18.  Everytime I try to use the servlet it throws an exception with an unsatisfiedlinkerror.  I've added LD_LIBRARY_PATH=/usr/lib to my catalina.sh & startup.sh, modified the classpath to include the .so, and copied the .so to server/lib, common/lib and nothing seems to be working.

Might anyone have some hints or simple examples of how to get this working?

Thanks,

Jay


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JNI with Servlets

Posted by Sergio Juan <sj...@gridsystems.com>.
Hi.

Have you linked the library (the best place to do it is at the init(), as
you can only link it once)? The code is something like this

  public void init () {
    try {
      //System.loadLibrary("myLib.so"); --> If you include it in
LD_LIBRARY_PATH
          System.load("/usr/local/lib/myLib.so");  // --> you don't need to
set LD_LIBRARY_PATH (I think)
     } catch (Exception ex) {
          System.out.println(" Can not load dinamic library. Reason: \n");
          ex.printStackTrace();
        }
    }

If you already do it please show your code so the group can help better.

Regards?

----- Original Message ----- 
From: <ma...@optonline.net>
To: <to...@jakarta.apache.org>
Sent: Saturday, July 05, 2003 2:25 AM
Subject: JNI with Servlets


> I'm attempting to use a shared library on Linux thats called from a
servlet that I have deployed on Tomcat 4.1.18.  Everytime I try to use the
servlet it throws an exception with an unsatisfiedlinkerror.  I've added
LD_LIBRARY_PATH=/usr/lib to my catalina.sh & startup.sh, modified the
classpath to include the .so, and copied the .so to server/lib, common/lib
and nothing seems to be working.
>
> Might anyone have some hints or simple examples of how to get this
working?
>
> Thanks,
>
> Jay
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org