Hello Gregory,

Nice that you've posted here the hot reloading issue, but have you
succeeded in deploying maven project under WTP?

We've tried today but failed. We required to do some .project hacks
but maven libraries are still not associated with the deployed WAR

Renat

On 05/09/07, Brysbaert Gregory <[EMAIL PROTECTED]> wrote:
> 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.Tapestry5DevClassLoader">
>
>         </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]
> Envoyé: jeudi 16 août 2007 18:59
> À: 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 Informação 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]
>
>


-- 
Best regards,
Renat Zubairov

Reply via email to