Re: Using native and ld_library_path

2005-02-02 Thread Andreas Andersson
Has no-one done this?
I think the problem is when the already loaded .so-file wants to load 
other .so's. The java.library.path is set correctly but perhaps only for 
tomcat and not for the loaded .so.

I've also tried to copy all of the required files to /usr/lib but 
without success.

Andreas Andersson wrote:
Hi again. I did take a look but nothing helped me there and I still need 
 help.

My guess is that tomcat has some restrictions when it comes to loading 
native code.

I have several native libraries. One of them is loaded and executed from 
my code, the rest is used by the first one.

What confuses me is that this works on my tomcat on windows but not 
linux. It also works on a standalone program on that same linux machine. 
But not my tomcat on linux.

I've tried putting the libraries in /usr/lib. That works for my 
standalone but not tomcat.

I've tried setting -Djava.library.path in catalina.sh, that doesn't work.
When printing System.getProperties().get(java.library.path) I get the 
right paths but still I get the unsatisfied link error. Is there more 
debug information available in some way?

This is really frustrating since it shouldn't be this hard :)
I appreciate any help.

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


Re: Using native and ld_library_path

2005-02-01 Thread Andreas Andersson
Caldarale, Charles R wrote:
Take a look at:
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html
Hi again. I did take a look but nothing helped me there and I still need 
 help.

My guess is that tomcat has some restrictions when it comes to loading 
native code.

I have several native libraries. One of them is loaded and executed from 
my code, the rest is used by the first one.

What confuses me is that this works on my tomcat on windows but not 
linux. It also works on a standalone program on that same linux machine. 
But not my tomcat on linux.

I've tried putting the libraries in /usr/lib. That works for my 
standalone but not tomcat.

I've tried setting -Djava.library.path in catalina.sh, that doesn't work.
When printing System.getProperties().get(java.library.path) I get the 
right paths but still I get the unsatisfied link error. Is there more 
debug information available in some way?

This is really frustrating since it shouldn't be this hard :)
I appreciate any help.
--
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]


RE: Using native and ld_library_path

2005-01-27 Thread Caldarale, Charles R
 From: Andreas Andersson [mailto:[EMAIL PROTECTED]
 Subject: Re: Using native and ld_library_path
 
 I never use System.loadLibrary() in the javacode that does 
 work (outside tomcat), do I have to?

Take a look at:
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html

 - 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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using native and ld_library_path

2005-01-26 Thread Andreas Andersson
Hi!
My application needs to use a native share library. When running normal 
java program from the commandline it works if I just set LD_LIBRARY_PATH 
to point to the .so-file. But since tomcat runs as suid (I guess thats 
why) LD_LIBRARY_PATH is ignored. What can I do instead? Is there any way 
I can set this parameter in tomcat?

I've turned of security to see if that could be the error but it wasn't.
Any help is welcome :)
--
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]


Re: Using native and ld_library_path

2005-01-26 Thread Ben Souther
Have you tried setting LD_LIBRARY_PATH as a java option at Tomcat
startup time?


On Wed, 2005-01-26 at 10:00, Andreas Andersson wrote:
 Hi!
 
 My application needs to use a native share library. When running normal 
 java program from the commandline it works if I just set LD_LIBRARY_PATH 
 to point to the .so-file. But since tomcat runs as suid (I guess thats 
 why) LD_LIBRARY_PATH is ignored. What can I do instead? Is there any way 
 I can set this parameter in tomcat?
 
 I've turned of security to see if that could be the error but it wasn't.
 
 Any help is welcome :)
 


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



Re: Using native and ld_library_path

2005-01-26 Thread Andreas Andersson
Ben Souther wrote:
Have you tried setting LD_LIBRARY_PATH as a java option at Tomcat
startup time?
I have tried to export the value (export 
LD_LIBRARY_PATH=/path/to/so-file) in both catalina.sh and 
/etc/init.d/tomcat4. Is there any other way to do it?

Could I do something like
java -DLD_LIBRARY_PATH=/path/to/so-file ?
--
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]


RE: Using native and ld_library_path

2005-01-26 Thread Caldarale, Charles R
 From: Andreas Andersson [mailto:[EMAIL PROTECTED]
 Subject: Re: Using native and ld_library_path
 
 Could I do something like
 java -DLD_LIBRARY_PATH=/path/to/so-file ?

Yes, except the property name is java.library.path (LD_LIBRARY_PATH is only the 
environment variable name).  The default for Linux systems is /usr/lib:/lib 
(for UNIX, it's just /usr/lib), so you could put the .so file there.

I think you have to be careful about where the System.loadLibrary() call is 
issued, since a native library can only be loaded for one class loader.  This 
has implications for sharing the code across applications and for redeploying 
applications.

 - 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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using native and ld_library_path

2005-01-26 Thread Andreas Andersson
Caldarale, Charles R wrote:
Yes, except the property name is java.library.path (LD_LIBRARY_PATH is only the environment variable name).  The default for Linux systems is /usr/lib:/lib (for UNIX, it's just /usr/lib), so you could put the .so file there.
I tried putting all of the files there but still get the same 
java.lang.UnsatisfiedLinkError when trying to invoke the method. When 
issuing the command 
System.out.println(System.getProperties().get(java.library.path));
right before the error occurs I can see the correct folders there. Is 
there anything else that would differ between running this through 
tomcat than from prompt?

I think you have to be careful about where the System.loadLibrary() call is issued, since a native library can only be loaded for one class loader.  This has implications for sharing the code across applications and for redeploying applications.
I never use System.loadLibrary() in the javacode that does work (outside 
tomcat), do I have to?

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