>>
>>They have to be seperate
>> because WEB-INF/classes is reloadable (and thus has to be
>> disposable) while WEB-INF/lib is meant to be static. So the
>> disposable CL has a parent CL that is responsible for
>> WEB_INF/lib
>
>OK, this means that the WEB-INF/lib ClassLoader cannot access
>the classes managed by the WEB-INF/classes classloader. Now,
>I don't have enough knowledge of Java internals to state what
>happens when I call 'Class.forName("myclass")' - what ClassLoader
>will be used... Does it depend on what CL loaded the class 
containg
>the code, or on the thread that is executing the code?
>
Yes, Class.forName("myclass") will load the class "myclass" with 
the classloader that loaded the currently executing class.  But,
this classloader will first defer to its parent classloader. (This 
is Java 2 style classloading. The convention of defering to the 
parent classloader was not as strictly encouraged in pre-Java 2.) 
>
>I can only say that Class.forName() works for me... I have the 
>modules
>(screens etc), and my model classes, including Services in 
>classes/
>and Turbine in lib/ and I haven't had any problems like that.
>Mayble it's JDK version dependent (I use 1.3/linux) or I am just 
lucky :-)
>
You not just lucky :-) If the class from which you call 
Class.forName("myService") was loaded from the system Classpath and 
myService is in classes/ or lib/, then myService will not be found.  
This is because the classloader that corresponds to the system 
classpath is a parent of the classloader that corresponds to lib/ 
or classes/ (under $TOMCAT_HOME/webapps/). 
So, the safest thing to do is put everything under 
$TOMCAT_HOME/webapps/myTurbineApp/.  This of course is not always 
practical and involves quite a bit of repetition.  But you 
definately should not have Turbine.jar or any of your application 
code in the system classpath when you start Tomcat. I usually keep 
a separate console (with a clean classpath) for starting and 
stopping Tomcat.  There was quite a bit of discussion (and 
confusion) on the Tomcat-dev mailing list a few months ago about 
classloader issues. 

-Brian Parker





------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to