I found that using the JBoss UnifiedClassLoader instead of the Tomcat 
class loader for web applications fixes the auto-reloading issues.

To change this setting you need to edit the following file:
JBoss 4.0.x
<server dir>/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
JBoss 4.2.x
<server dir>/deploy/jbossweb.deployer/META-INF/jboss-service.xml

Search for the attribute "UseJBossWebLoader" and set it to true.

Note: Changing this may affect how your web-app resolves classes.  
I think the Tomcat classloader always loads classes for the webapp 
libs first, even if the class exists in a parent classloader.  
The JBoss classloader says it follows standard behaviour and will use
classes from the parent classloader over classes from the webapp.

cheers
Ben

> -----Original Message-----
> From: Geoff Callender [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, 30 September 2007 12:07 AM
> To: Tapestry users
> Subject: Re: T5: the scanner and JBoss
> 
> Nick, thanks for pointing out the earlier e-mail.
> 
> Unfortunately, it doesn't deal with how to auto-reload html 
> templates.  Tapestry5DevClassLoader only ensures class files 
> are reloaded.
> 
> Any other suggestions?
> 
> On 28/09/2007, at 9:24 PM, Nick Westgate wrote:
> 
> > Geoff Callender wrote:
> > > T5 isn't picking up changes to templates and component 
> classes in my 
> > > environment.  T5.0.5 is a jar in an exploded WAR in an 
> exploded EAR, 
> > > which JBoss has been told to use (it's pointed to in 
> > > jboss-service.xml).  When I make changes to the web app they are
> > copied
> > > immediately to the exploded ear but T5 just isn't picking them up.
> > >
> > > I saw on Howard's blog that he'd had a problem with 
> JBoss/Tomcat...
> > >
> > >      http://tapestryjava.blogspot.com/2007/02/fighting-with-
> > tomcat.html
> > >      http://issues.apache.org/bugzilla/show_bug.cgi?id=41664
> > >
> > > ...but the 5.0.5 source looks like it has the necessary fix.   
> > Besides,
> > > I'm using an ear that's already exploded so I shouldn't 
> be getting 
> > > Howard's problem.  True?
> > >
> > > Does anyone have a theory on why it isn't working?
> > > Alternatively can anyone point me to the scanner class so I can
> > debug
> > > what it isn't doing?
> > >
> > > Geoff
> >
> >
> > The problem with Tomcat was identified in the following email as a 
> > classloader caching issue. I've not tested this though.
> >
> > Cheers,
> > Nick.
> >
> >
> >
> > -------- Original Message --------
> > Subject: RE: T5 developing with WTP and TOMCAT
> > Date: Wed, 5 Sep 2007 17:59:14 +0200
> > From: Brysbaert Gregory <[EMAIL PROTECTED]>
> > Reply-To: Tapestry users <users@tapestry.apache.org>
> > To: Tapestry users <users@tapestry.apache.org>
> >
> > Hello,
> >
> > About this topic, I tried some investigations on my side, 
> and I found 
> > out that the reason why classes don't auto-reload is that the 
> > WebappClassLoader of tomcat 5 (I currently use tomcat 5.0, 
> but I guess 
> > it's the same on Tomcat 5.5) keeps in cache (in a Hashtable more
> > precisely) all classes it already loaded once. And this 
> cache is never 
> > cleared, except when the WebappClassLoader is stopped. So, when the 
> > class file is modified on the disk, tapestry 5 clears its 
> own cache, 
> > and then asks to the parent classloader (WebAppClassLoader) 
> to reload 
> > the class, which then serves the previous version of the class from 
> > its cache. The result is that the class is never actually updated 
> > until the next restart of tomcat.
> >
> >
> > So, as a temporary solution, I tried to develop a class extending 
> > WebappClassLoader that does not cache classes for packages 
> containing 
> > ".pages." and ".components.". The source of this class is :
> >
> >
> > public class Tapestry5DevClassLoader extends WebappClassLoader{
> >             
> >      private static String[] noCacheElements={".pages.","/ 
> > pages/",".components.","/components/"};
> >     
> >     public Tapestry5DevClassLoader() {
> >             super();
> >                             
> >     }
> >
> >     public Tapestry5DevClassLoader(ClassLoader arg0) {
> >             super(arg0);
> >     
> >     }
> >     
> >     
> >
> >     @Override
> >     protected InputStream findLoadedResource(String arg0) {
> >             InputStream is=super.findLoadedResource(arg0);
> >             if (is!=null){
> >                     if (isNoCacheElement(arg0))
> >                             return null;
> >             }
> >             return is;
> >     }
> >     
> >     private boolean isNoCacheElement(String name){
> >             
> >             for (int i=0;i<noCacheElements.length;i++){
> >                     if (name.indexOf(noCacheElements[i])>=0)
> >                             return true;
> >             }
> >             
> >             return false;
> >             
> >     }
> >
> >             
> >     
> > }
> >
> >
> >
> >
> > To make it work, you have to do 2 things :
> > - Compile the class and add it to the server/classes (or 
> server/lib if 
> > you package it in a jar) directory of your tomcat installation 
> > directory.
> > - in your server.xml file, modify the context declaration 
> and disable 
> > tomcat's auto-reloading functionality, and declare the 
> newly created 
> > classloader instead of the default one :
> >
> >
> > <Context docBase="testtapestry5" path="/testtapestry5"  
> > reloadable="false" 
> source="org.eclipse.jst.j2ee.server:testtapestry5">
> >             <Loader
> > 
> loaderClass="net.atos.mm.fwk.tapestry5.classloader.Tapestry5DevClassLo
> > ader">
> >             
> >             </Loader>
> > </Context>
> >
> > This is of course a temporary solution, but I tried it and it works 
> > for me.
> >
> > Waiting for something better, I hope it can help.
> >
> > Gregory Brysbaert
> >
> > -----Message d'origine-----
> > De : Thiago H de Paula Figueiredo 
> [mailto:[EMAIL PROTECTED] Envoye : 
> > jeudi 16 aout 2007 18:59 A : Tapestry users Objet : Re: T5 
> developing 
> > with WTP and TOMCAT
> >
> > On Thu, 16 Aug 2007 12:54:31 -0300, Denny 
> <[EMAIL PROTECTED]> wrote:
> >
> > > Ok, now, I am using jettylauncher eclipse plugin to develop T5. I
> > hope T5
> > > can fix the problem about working with tomcat. There are 
> many people 
> > > using tomcat for develop and product.
> >
> > It's a Tomcat issue, not a Tapestry one. Howard explains 
> the problem 
> > here:
> > http://tapestryjava.blogspot.com/2007/02/fighting-with-tomcat.html
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg 
> Tecnologia da 
> > Informacao Ltda.
> > http://www.eteg.com.br
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to