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
[EMAIL PROTECTED]
http://www.travelstart.se

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to