You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Manoj Thakur <mt...@telesciences.com> on 2001/02/02 17:27:54 UTC

Tomcat + JNI problem

Hello Amandeep,

Hope you can help me. I am running Tomcat version 3.1 on HPUX 11.0 with
Apache.

What I am trying to do is invoke a C function (using JNI) from a
servlet. The C function is compiled into a shared library.

Now, if I write a simple JAVA application, use JNI and execute the C
function, everything works file. But, then if I change it from being an
application to a servlet, then it fails. Also, the reason is not that it
is not able to find and load the library (as if I remove the library or
rename it, it gives an error indicating it was unable to load the
library). But, the error indicates it was unable to locate the method
that I am trying to invoke. In fact, going through the getMethods
function, I listed all the methods loaded and available for the class,
and the native C function is also listed as one of the functions that
can be called. But, that may just be because the native C function is
listed in the class definition as per JNI requirements.

Your email is the first one where I know that somebody has successfully
implemented JNI in a servlet. Could you share if you had any problems in
your effort. Also, if you could take a few minutes, I could email you my
test example (a very simple login example) to take a look if I am
missing something obvious.

Regards and Thanks in advance
-- Manoj Thakur

> 
> To: <to...@jakarta.apache.org> 
> Subject: Can I set LD_LIBRARY_PATH for each virtual host 
> From: "Amandeep Jawa" <de...@imagelock.com> 
> Date: Tue, 17 Oct 2000 17:33:24 -0700 
> Delivered-To: mailing list tomcat-user@jakarta.apache.org 
> list-help: <ma...@jakarta.apache.org> 
> list-post: <ma...@jakarta.apache.org> 
> list-unsubscribe: <ma...@jakarta.apache.org> 
> Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by
ezmlm 
> Organization: Imagelock, Inc. 
> Reply-To: tomcat-user@jakarta.apache.org 
> Reply-To: "Amandeep Jawa" <de...@imagelock.com> 
> 
> 
> 
> Hi folks -
> 
> For JNI purposes I have to have LD_LIBRARY_PATH set for my servlets.
My
> servlets seem to be able to make simple C calls so everything is Ok so
far.
> The problem is that I am setting the library path for the entire
tomcat
> installation when I'd really like to set it per virtual host or per
servlet
> context in server.xml.
> 
> Does anyone know how to do this?
> 
> Sorry if this is a well known solution but the FAQ is down which seems
to be
> pretty common!
> 
> 'deep
> 
> 
> --------------------------
> Amandeep Jawa
> Imagelock, Inc.
> --------------------------
> deep@imagelock.com
> 1725 Montgomery St
> San Francisco CA 94111
> 
> Work: 415 616 7262 (616 SAMBA)
> Fax: 415 392 5382
> 
> http://www.imagelock.com

Manoj Thakur
Email: mthakur@telesciences.com
Work: +1 856 866 1000 x4166
Fax:   +1 856 866 0185