On Tue, Feb 08, 2005 at 10:53:37PM +0100, Andreas Andersson wrote:
> 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?

        I'm not certain about debian, but under NetBSD you can turn on tracing
for an already running process.  (ktrace -p <pid>)  I'd imagine there'd be
something similar under linux.  Check the strace man page.  Keep in mind that
this can create a _lot_ of output.

> >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?

        The LD_DEBUG env variable would actually be interpreted by the
dynamic linker code, so it's irrelevant whether tomcat ignores it or not.
Tomcat will rely on the JVM's library loading functions, which in turn
should use dlopen() and related functions.

> >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.

        That really depends on how much the library depends on java.  If
it's a C/C++ library that had a thin JNI layer added on afterwards you
can probably write a C/C++ program to use it fairly easily.  A good indicator
of this is if the .so comes with C/C++ header files, and if the java interface
is light on it's use of objects.  (e.g. all function arguments and return
values are primitives, or data-only objects)  Of course, if the library
wasn't written that way you might not have an easy to use C function to call.

eric

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

Reply via email to