UnsatisfiedLinkError while using JNI

2006-11-18 Thread Daniel Wildschut
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,
I am using JNI to load a library which
I use for a Web Service running on a Tomcat5.5-Server
using Axis. My problem is that when I call a native function
it immediatly fails with java.lang.UnsatisfiedLinkError:
new_ParticleSocket__SWIG_0 ( new_ParticleSocket__SWIG_0 being the
function called ). No further information is provided by the exception.
After checking the obvious ( classpath and
java.library.path/LD_LIBRARY_PATH, also checked if the library was
loaded twice ) I checked the library itself ( which is generated by SWIG
1.3.29 ) using nm to see if all symbols were generated correctly ( which
they were, the symbols are all in the form
Java_edu_teco_particles_libParticle_libparticleJNI_* and in a standalone
form without the prefix).
I then used LD_DEBUG=all to check if the library was indeed loaded.
There I found that the library was loaded however when JNI searches for
the necessary function it does not search the newly loaded library.
( A lookup is performed on all libraries loaded before but not on the
new library )
I am using Debian GNU/Linux with Sun JDK 1.5.08

Any help would be appreciated

 - Daniel Wildschut
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFX3dDUS3Mvw9vkgURArBYAJ9HFskU8O8jSXvBibCA0X+mqv4FPwCbBIDk
jRUTnbGR1+t+ejlH9OLCoTk=
=VkIX
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: UnsatisfiedLinkError while using JNI

2006-11-18 Thread Martin Gainty
the entries in the LD_LIBRARY_PATH must be colon separated
if your setting thru bash make sure you export LD_LIBRARY_PATH
If none that works take a look at these LD_LIBRARY_PATH diagnostics
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

M-
This e-mail communication and any attachments may contain confidential and 
privileged information for the use of the 
designated recipients named above. If you are not the intended recipient, you 
are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its 
contents
- Original Message - 
From: Daniel Wildschut [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Saturday, November 18, 2006 4:12 PM
Subject: UnsatisfiedLinkError while using JNI


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello,
 I am using JNI to load a library which
 I use for a Web Service running on a Tomcat5.5-Server
 using Axis. My problem is that when I call a native function
 it immediatly fails with java.lang.UnsatisfiedLinkError:
 new_ParticleSocket__SWIG_0 ( new_ParticleSocket__SWIG_0 being the
 function called ). No further information is provided by the exception.
 After checking the obvious ( classpath and
 java.library.path/LD_LIBRARY_PATH, also checked if the library was
 loaded twice ) I checked the library itself ( which is generated by SWIG
 1.3.29 ) using nm to see if all symbols were generated correctly ( which
 they were, the symbols are all in the form
 Java_edu_teco_particles_libParticle_libparticleJNI_* and in a standalone
 form without the prefix).
 I then used LD_DEBUG=all to check if the library was indeed loaded.
 There I found that the library was loaded however when JNI searches for
 the necessary function it does not search the newly loaded library.
 ( A lookup is performed on all libraries loaded before but not on the
 new library )
 I am using Debian GNU/Linux with Sun JDK 1.5.08
 
 Any help would be appreciated
 
 - Daniel Wildschut
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.5 (GNU/Linux)
 
 iD8DBQFFX3dDUS3Mvw9vkgURArBYAJ9HFskU8O8jSXvBibCA0X+mqv4FPwCbBIDk
 jRUTnbGR1+t+ejlH9OLCoTk=
 =VkIX
 -END PGP SIGNATURE-
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: UnsatisfiedLinkError while using JNI

2006-11-18 Thread Daniel Wildschut
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,
the library itself is found and loaded ( at least according to
LD_DEBUG=all ), also if the library is not in the LD_LIBRARY_PATH I get
a different error ( the runtime telling me the library could not be loaded).

- - Daniel Wildschut

Martin Gainty wrote:
 the entries in the LD_LIBRARY_PATH must be colon separated
 if your setting thru bash make sure you export LD_LIBRARY_PATH
 If none that works take a look at these LD_LIBRARY_PATH diagnostics
 http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
 
 M-
 This e-mail communication and any attachments may contain confidential and 
 privileged information for the use of the 
 designated recipients named above. If you are not the intended recipient, you 
 are hereby notified that you have received
 this communication in error and that any review, disclosure, dissemination, 
 distribution or copying of it or its 
 contents
 - Original Message - 
 From: Daniel Wildschut [EMAIL PROTECTED]
 To: users@tomcat.apache.org
 Sent: Saturday, November 18, 2006 4:12 PM
 Subject: UnsatisfiedLinkError while using JNI
 
 
 Hello,
 I am using JNI to load a library which
 I use for a Web Service running on a Tomcat5.5-Server
 using Axis. My problem is that when I call a native function
 it immediatly fails with java.lang.UnsatisfiedLinkError:
 new_ParticleSocket__SWIG_0 ( new_ParticleSocket__SWIG_0 being the
 function called ). No further information is provided by the exception.
 After checking the obvious ( classpath and
 java.library.path/LD_LIBRARY_PATH, also checked if the library was
 loaded twice ) I checked the library itself ( which is generated by SWIG
 1.3.29 ) using nm to see if all symbols were generated correctly ( which
 they were, the symbols are all in the form
 Java_edu_teco_particles_libParticle_libparticleJNI_* and in a standalone
 form without the prefix).
 I then used LD_DEBUG=all to check if the library was indeed loaded.
 There I found that the library was loaded however when JNI searches for
 the necessary function it does not search the newly loaded library.
 ( A lookup is performed on all libraries loaded before but not on the
 new library )
 I am using Debian GNU/Linux with Sun JDK 1.5.08
 
 Any help would be appreciated
 
 - Daniel Wildschut

- -
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFX39wUS3Mvw9vkgURAixpAKCh2kMLolGaGQjSbNhSHmSVYSLNbQCgzDsk
2WUnnKZboeY2/o+mTiXHudc=
=K55o
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: UnsatisfiedLinkError while using JNI

2006-11-18 Thread Caldarale, Charles R
 From: Daniel Wildschut [mailto:[EMAIL PROTECTED] 
 Subject: UnsatisfiedLinkError while using JNI

 I then used LD_DEBUG=all to check if the library was indeed loaded.
 There I found that the library was loaded however when JNI searches
 for the necessary function it does not search the newly loaded
library.

This may be a classloader conflict.  What triggers the loading of the
native library?  If this is done under a classloader that's not in the
same branch of the tree that's now making the reference to the native
method, it may not be able to find it.  Look at:
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
for Tomcat classloading info.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: UnsatisfiedLinkError while using JNI

2006-11-18 Thread Daniel Wildschut
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,
I checked the classloader and indeed the problem was
a classloader conflict ( the imported classes used the System-default
ClassLoader, which lead to the problem ).
I was able to place the call to LoadLibrary into a separate class
which I put into the classpath. This solved the problem.

Thank you for your time  advice

- - Daniel Wildschut

Caldarale, Charles R wrote:
 From: Daniel Wildschut [mailto:[EMAIL PROTECTED] 
 Subject: UnsatisfiedLinkError while using JNI

 I then used LD_DEBUG=all to check if the library was indeed loaded.
 There I found that the library was loaded however when JNI searches
 for the necessary function it does not search the newly loaded
 library.
 
 This may be a classloader conflict.  What triggers the loading of the
 native library?  If this is done under a classloader that's not in the
 same branch of the tree that's now making the reference to the native
 method, it may not be able to find it.  Look at:
 http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
 for Tomcat classloading info.
 
  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail
 and its attachments from all computers.
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFX5auUS3Mvw9vkgURAolnAJ9g/TckEBJCaiSz7s4nS0lfDMBvZgCfdUUB
aSL3e87jRRe9Av8L7WmFCKw=
=Dt97
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



using JNI

2006-11-15 Thread Zohar

Hi,
I have a DLL that I need to use from some of my servlets. Where should I put 
the DLL? How do I load the DLL from all those servlets (should it be loaded 
only once?)?

Is there anywhere I can read about this?
Thanks,
Zohar. 



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]