Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dennis, On 7/5/2010 3:35 AM, dennis ch wrote: > modelJNI.java > === > public final static native void initModel(); > > native code > = > #include > #include > #include [snip] > void initModel() { You can't use JNI like that. Y

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-05 Thread Ihor Chumak
Had You tried to made c header by javah -jni ./your_packages/your_class.class ? It gives header for You with properly named method to be written in c.. On Mon, Jul 5, 2010 at 4:11 PM, Konstantin Kolinko wrote: > 2010/7/2 dennis ch : > > Do I miss anything here? Any input is appreciated! > > > >

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-05 Thread Konstantin Kolinko
2010/7/2 dennis ch : > Do I miss anything here?  Any input is appreciated! > IIRC, native libraries can be loaded only once, but webapplication classloader is disposed and recreated each time the web application is stopped/reloaded. Thus the class that loads your library must be in ${catalina.base

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-05 Thread dennis ch
Hi Shay, Thanks for your input. And yes, I did see the "Load library successful" message. I've also fixed the code with static { } block. However, I still received the same error message. Any other thoughts? Thanks, Dennis 2010/7/2 Shay Rojansky > Hi Dennis. > > So do you see the "Load lib

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-05 Thread dennis ch
lson=mediacomcc@tomcat.apache.org[users-return-214329-racarlson= > mediacomcc@tomcat.apache.org] On Behalf Of Shay Rojansky [ > r...@roji.org] > Sent: Saturday, July 03, 2010 12:40 AM > To: Tomcat Users List > Subject: Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError > &

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-05 Thread dennis ch
Hi Chris, Thanks for your reply. I recompiled everything and checked method signature, but still got the same error. I felt it's weird why it worked for standalone app but not deployed web service... Thanks. model.java public static void initModel() { modelJNI.initModel(); }

RE: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-04 Thread Ralph Carlson
Behalf Of Shay Rojansky [r...@roji.org] Sent: Saturday, July 03, 2010 12:40 AM To: Tomcat Users List Subject: Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError Hi Dennis. So do you see the "Load library successful" message? Also, if I remember correctly, the code in eval.java is

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dennis, On 7/2/2010 3:46 AM, dennis ch wrote: > However, when I deploy it as a web service (tomcat 6.0.26 + axis2 1.5.1 + > eclipse jee helios) to call the native method, I got the following error > (the first line means the .so was successfully loade

Re: JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-02 Thread Shay Rojansky
Hi Dennis. So do you see the "Load library successful" message? Also, if I remember correctly, the code in eval.java is not a safe way to load a native library. It's a very good idea to place the System.loadLibrary in a static { } block, instead of in a method. The way your class is written, it's

JNI error under tomcat: java.lang.UnsatisfiedLinkError

2010-07-02 Thread dennis ch
Hi, I have a java class (eval.java) that invokes a native method in an so file (libmodel.so, using SWIG 1.3.29 to generate JNI code/wrapper and compiled the library). I can use System.loadLibrary() to load the libmodel.so without any error (-Djava.library.path=/usr/lib), and the native method init