tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Andersson <andr...@travelstart.se>
Subject Re: using shared objects from tomcat
Date Tue, 08 Feb 2005 21:53:37 GMT
Benson Margulies wrote:

First of all, thanks for the answer, I've been fighting this one for 
quite som time now.

> 1) Your monitoring options depend on what unix(-like) system you are
> running on. On Linux, there's strace. On Solaris, truss. On HPUX and
> AIX? I forget. To do this PROGRAMMATICALLY to create a sandbox? Forget
> it. The Unix Approach is this:

This is a debian suggesting strace to be the one for me. Can I attach 
strace to my .so-file or do I have to start tomcat via strace?

> 2) Generally, you can get some clues on UnsatisfiedLinkError, in a
> pinch, by using LD_DEBUG or strace (or truss or whatever).

If I'm not misstaken tomcat ignores environment variables so how can I 
set LD_DEBUG?

> A) Any .so has to be in java.library.path and in LD_LIBRARY_PATH. Any
> dependencies of the .so (visible with 'ldd', likewise).

java.library.path _AND_ LD_LIBRARY_PATH? Thats intersting and might very 
well be the solution to my problem. As I just wrote I think tomcat 
ignores these evironment variabels. I was under the impression that 
LD_LIBRARY_PATH was the same as java.library.path, if that is not the 
case then how do I set LD_LIBRARY_PATH?

> Thus, I always put native classes in the 'common' classloader by adding
> the jars to common.loader in catalina.properties.

Is it also OK to add .so-files? I have

grant codeBase "file:${catalina.home}/common/-" {
   permission java.security.AllPermission;
};

in my catalina.properties. Would that suggest that if I only placed all 
.so-files under /common they would be loaded or at least accessable?

> 4) I have come to believe that the shared objects that you use for JNI
> should be thin wrappers that make their own calls to dlopen/dlsym to
> find the guts of your code. This insulates you from the various stupid
> things that the JVM makers do from time to time in picking the wrong
> arguments to dlopen.
 >
> 5) Consider using an RPC protocol to talk to a server written in C/C++
> instead of using JNI in the first place. If the performance is
> acceptable, your life could be a lot simpler.

Unfortunatly the codes in the .so-files isn't mine. It's a third party 
product that we can't alter or even have altered for us.

-- 
Andreas Andersson
IT Dept.
Travelstart Nordic
andreas@travelstart.se
http://www.travelstart.se

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


Mime
View raw message