Re: $CATALINA_HOME/shared/lib is *STILL* Ignored....

2003-09-04 Thread Remy Maucherat
Tony LaPaso wrote:

Hi all,

I posted a similar question a couple days ago but it seems the well-intended
responses I received were incorrect.
And let me first say that I have RTFMs -- more than once -- and this
*SHOULD* work, at least according to TFMs.
I'm using TC v5.0.9 on Linux with J2SE 1.4.2_01.

Very simply, I have a Jar with some custom classes in
$CATALINA_HOME/shared/lib/. These classes are not being found in my web
application. Instead, I get a NoClassDefFoundError. If I move the Jar to
$CATALINA_HOME/common/lib/, the classes are found with no problem.
Somebody, please, just do what I described above and tell me if you can get
classes to load from a jar in $CATALINA_HOME/shared/lib.
According to the Tomcat docs, Jar files in $CATALINA_HOME/shared/lib/
*SHOULD BE AVAILABLE* to a web app. See the TC documentation at:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html
I'm wondering if the TC docs are once again in error
Please don't whine.

As far as I am concerned, the feature works, and the documetation is 
right. However, the shared CL is very error prone because it is stuck in 
between the two main CL (the webapp CL and the main common CL) for class 
visibility problems.
(ie, the JARs from common can't see JARs form the shared loader, and the 
JARs in shared can't see the JARs in the webapp CL)

Inside your webapp code, you can do a 
Thread.currentThread().getContextClassLoader().toString() to get a view 
of the CL hierarchy and all the class repositories which are initialized 
on each level.

--
x
Rémy Maucherat
Senior Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


$CATALINA_HOME/shared/lib is *STILL* Ignored....

2003-09-03 Thread Tony LaPaso
Hi all,

I posted a similar question a couple days ago but it seems the well-intended
responses I received were incorrect.

And let me first say that I have RTFMs -- more than once -- and this
*SHOULD* work, at least according to TFMs.

I'm using TC v5.0.9 on Linux with J2SE 1.4.2_01.

Very simply, I have a Jar with some custom classes in
$CATALINA_HOME/shared/lib/. These classes are not being found in my web
application. Instead, I get a NoClassDefFoundError. If I move the Jar to
$CATALINA_HOME/common/lib/, the classes are found with no problem.

Somebody, please, just do what I described above and tell me if you can get
classes to load from a jar in $CATALINA_HOME/shared/lib.

According to the Tomcat docs, Jar files in $CATALINA_HOME/shared/lib/
*SHOULD BE AVAILABLE* to a web app. See the TC documentation at:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html

I'm wondering if the TC docs are once again in error

Thanks very much.sincerely.

Tony



-
side-note
Finally, for the sake of completeness, I'd like to correct something someone
said in response to my previous post.

A NoClassDefFoundError does *NOT* mean the class was found. It means the
class was *NOT* found, as does ClassNotFoundException. The difference
between these two errors has to do with the mechanism by which the class
load operation was initiated.

ClassNotFoundException is thrown when a class cannot be found and the
programmer tried to load the class *explicitly* using Class.forName() or a
ClassLoader method. For example:
Class c = Class.forName(MyClass);

NoClassDefFoundError is thrown when a class cannot be found and the
programmer tried to load the class *implicitly* by referring to the class
name. For example:
MyClass x = new MyClass();

Both exceptions mean the class cannot be found. I am assuming that when
Tomcat throws one of these two errors it is following the usage guidelines
laid out in the javadocs for these errors.
/side-note


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