You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shannon Scott <ss...@locationinc.com> on 2006/03/03 14:17:28 UTC
Linux JNI ClassLoad
Greetings,
I have been trying to use some Native C code in one of my applications.
I have it working, but after it runs once it fails.
The release-notes mention that:
"To avoid this problem, place classes that load native libraries outside
of the web application, and ensure that the loadLibrary() call is
executed only once during the lifetime of a particular JVM."
>From here:
http://tomcat.apache.org/tomcat-5.0-doc/class-loader-howto.html
I read:
"For classes and resources that must be shared across all web
applications,
place unpacked classes and resources under
$CATALINA_BASE/shared/classes,
or place JAR files containing those classes and resources under
$CATALINA_BASE/shared/lib."
When I place class files into my $CATALINA_BASE/shared/classes, I get
the
'NoClassDefFoundError' error. I have also tried a package in
$CATALINA_BASE/shared/lib.
Has anyone successfully resolved this issue on the Linux platform?
Where is the config that tells tomcat to load classes from
$CATALINA_BASE/shared/classes? It seems like mine is not configured
correctly because they don't seem to get loaded.
Any pointers or advice is greatly appreciated.
Take care.
S
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Linux JNI ClassLoad
Posted by Richard Toren <ri...@supportx.com>.
Hello,
I use the SleepyCat dbxml which is also JNI and I have to do the
following:
export JAVA_OPTS='-Djava.library.path=/path/to/folder/with/so'
then...
sh catalina.sh .run
I'd wager that you would have to do the same......
Richard
Shannon Scott wrote:
>Greetings,
>I have been trying to use some Native C code in one of my applications.
>I have it working, but after it runs once it fails.
>The release-notes mention that:
>"To avoid this problem, place classes that load native libraries outside
>of the web application, and ensure that the loadLibrary() call is
>executed only once during the lifetime of a particular JVM."
>
>>>From here:
>http://tomcat.apache.org/tomcat-5.0-doc/class-loader-howto.html
>I read:
>"For classes and resources that must be shared across all web
>applications,
>place unpacked classes and resources under
>$CATALINA_BASE/shared/classes,
>or place JAR files containing those classes and resources under
>$CATALINA_BASE/shared/lib."
>
>When I place class files into my $CATALINA_BASE/shared/classes, I get
>the
>'NoClassDefFoundError' error. I have also tried a package in
>$CATALINA_BASE/shared/lib.
>
>Has anyone successfully resolved this issue on the Linux platform?
>Where is the config that tells tomcat to load classes from
>$CATALINA_BASE/shared/classes? It seems like mine is not configured
>correctly because they don't seem to get loaded.
>Any pointers or advice is greatly appreciated.
>Take care.
>S
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Linux JNI ClassLoad
Posted by Shannon Scott <ss...@locationinc.com>.
Mike,
Thank you for your response. I have tried to place my shared object
files into /usr/local/lib which is in the LD_LIBRARY_PATH environment
variable for my tomcat config.
When I place my class files in $CATALINA_BASE/common/classes, the
function works correctly ( library is found ), but only once ( because
the Native code cannot be loaded more than once in the JVM, I suppose ).
When I place my class files in $CATALINA_BASE/shared/classes, which is
what the docs explain is appropriate for resolving this issue, the class
cannot be found. Is anyone else having trouble loading classes from
$CATALINA_BASE/shared/classes?
Thanks again.
Shannon
-----Original Message-----
From: Mike Sabroff [mailto:mike.sabroff@cygnusb2b.com]
Sent: Friday, March 03, 2006 11:29 AM
To: Tomcat Users List
Subject: Re: Linux JNI ClassLoad
I "think" that this can be done with the environment variable
"LD_LIBRARY_PATH" which will point to your C object file.
This is an uneducated guess, but worth a try.
Mike
Shannon Scott wrote:
> Greetings,
> I have been trying to use some Native C code in one of my
applications.
> I have it working, but after it runs once it fails.
> The release-notes mention that:
> "To avoid this problem, place classes that load native libraries
outside
> of the web application, and ensure that the loadLibrary() call is
> executed only once during the lifetime of a particular JVM."
>
> From here:
> http://tomcat.apache.org/tomcat-5.0-doc/class-loader-howto.html
> I read:
> "For classes and resources that must be shared across all web
> applications,
> place unpacked classes and resources under
> $CATALINA_BASE/shared/classes,
> or place JAR files containing those classes and resources under
> $CATALINA_BASE/shared/lib."
>
> When I place class files into my $CATALINA_BASE/shared/classes, I get
> the
> 'NoClassDefFoundError' error. I have also tried a package in
> $CATALINA_BASE/shared/lib.
>
> Has anyone successfully resolved this issue on the Linux platform?
> Where is the config that tells tomcat to load classes from
> $CATALINA_BASE/shared/classes? It seems like mine is not configured
> correctly because they don't seem to get loaded.
> Any pointers or advice is greatly appreciated.
> Take care.
> S
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Linux JNI ClassLoad
Posted by Mike Sabroff <mi...@cygnusb2b.com>.
I "think" that this can be done with the environment variable
"LD_LIBRARY_PATH" which will point to your C object file.
This is an uneducated guess, but worth a try.
Mike
Shannon Scott wrote:
> Greetings,
> I have been trying to use some Native C code in one of my applications.
> I have it working, but after it runs once it fails.
> The release-notes mention that:
> "To avoid this problem, place classes that load native libraries outside
> of the web application, and ensure that the loadLibrary() call is
> executed only once during the lifetime of a particular JVM."
>
> From here:
> http://tomcat.apache.org/tomcat-5.0-doc/class-loader-howto.html
> I read:
> "For classes and resources that must be shared across all web
> applications,
> place unpacked classes and resources under
> $CATALINA_BASE/shared/classes,
> or place JAR files containing those classes and resources under
> $CATALINA_BASE/shared/lib."
>
> When I place class files into my $CATALINA_BASE/shared/classes, I get
> the
> 'NoClassDefFoundError' error. I have also tried a package in
> $CATALINA_BASE/shared/lib.
>
> Has anyone successfully resolved this issue on the Linux platform?
> Where is the config that tells tomcat to load classes from
> $CATALINA_BASE/shared/classes? It seems like mine is not configured
> correctly because they don't seem to get loaded.
> Any pointers or advice is greatly appreciated.
> Take care.
> S
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org