RE: T5 developing with WTP and TOMCAT

2007-09-05 Thread Brysbaert Gregory
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;inoCacheElements.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]



Re: T5 developing with WTP and TOMCAT

2007-09-05 Thread Renat Zubairov
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;inoCacheElements.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


Re: T5 developing with WTP and TOMCAT

2007-08-16 Thread Denny
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.

On 8/15/07, Denny deng [EMAIL PROTECTED] wrote:


 Hi,

 I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
 tapestry5 can take the changes of html template, while it can't take the
 chages of page class. It make the hot code replace failed. However, If I
 enable tomcat auto-reload. tapestry can take both html template and page
 class changes. But, it will cause tomcat reload the context. It's very
 slow,
 and after some times, it will cause tomcat out of memory. I know using
 Jetty
 servlet container will be fine. But I like developing with eclipse WTP.

 So I like the way of T3, T4, just add a java system property.
 -Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit
 slow while reload the page.
 --
 View this message in context:
 http://www.nabble.com/T5-developing-with-WTP-and-TOMCAT-tf4273924.html#a12164566
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


Re: T5 developing with WTP and TOMCAT

2007-08-16 Thread Daniel Jue
I use Tomcat 5.5.23 and WTP for development.  My context probably
reloads 200-400 times a day.  Only when  I am making changes to
web.xml/context.xml, log4j.properties, hibernate xmls do I need to
stop and then start the server again.

I have never run into a memory issue, although if I run modules
directly from workspace the temp directory under my
workspace/.metadata//server-core can get hosed sometimes.  I've
had more reliability running straight from the Tomcat container, with
everything initialized through WTP.

On 8/16/07, 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.

 On 8/15/07, Denny deng [EMAIL PROTECTED] wrote:
 
 
  Hi,
 
  I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
  tapestry5 can take the changes of html template, while it can't take the
  chages of page class. It make the hot code replace failed. However, If I
  enable tomcat auto-reload. tapestry can take both html template and page
  class changes. But, it will cause tomcat reload the context. It's very
  slow,
  and after some times, it will cause tomcat out of memory. I know using
  Jetty
  servlet container will be fine. But I like developing with eclipse WTP.
 
  So I like the way of T3, T4, just add a java system property.
  -Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit
  slow while reload the page.
  --
  View this message in context:
  http://www.nabble.com/T5-developing-with-WTP-and-TOMCAT-tf4273924.html#a12164566
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Regards

 Denny
 Site: http://dengyin2000.javaeye.com


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



Re: T5 developing with WTP and TOMCAT

2007-08-16 Thread Thiago H de Paula Figueiredo

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]



T5 developing with WTP and TOMCAT

2007-08-15 Thread Denny deng

Hi,

I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
tapestry5 can take the changes of html template, while it can't take the
chages of page class. It make the hot code replace failed. However, If I
enable tomcat auto-reload. tapestry can take both html template and page
class changes. But, it will cause tomcat reload the context. It's very slow,
and after some times, it will cause tomcat out of memory. I know using Jetty
servlet container will be fine. But I like developing with eclipse WTP.

So I like the way of T3, T4, just add a java system property.
-Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit
slow while reload the page.
-- 
View this message in context: 
http://www.nabble.com/T5-developing-with-WTP-and-TOMCAT-tf4273924.html#a12164566
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



T5 developing with WTP and TOMCAT

2007-08-14 Thread Denny
Hi,

I develop with WTP and TOMCAT. If I set the tomcat don't auto-reload,
tapestry5 can take the changes of html template, while it can't take the
chages of page class. It make the hot code replace failed. However, If I
enable tomcat auto-reload. tapestry can take both html template and page
class changes. But, it will cause tomcat reload the context. It's very slow,
and after some times, it will cause tomcat out of memory. I know using Jetty
servlet container will be fine. But I like developing with eclipse WTP.

So I like the way of T3, T4, just add a java system property. -
Dorg.apache.tapestry.disable-caching=true. It would be fine. just a bit slow
while reload the page.

-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com