You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Sommerville <be...@bulletproof.com.au> on 2007/10/01 15:53:40 UTC

RE: T5: the scanner and JBoss

Switching to the JBoss classloader also makes auto-loading of html
templates
work for me.

Have you tried the html auto-loading after making the classloader change?

cheers
Ben


> -----Original Message-----
> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com] 
> Sent: Monday, 1 October 2007 6:52 AM
> To: Tapestry users
> Subject: Re: T5: the scanner and JBoss
> 
> Nice one, Ben.  For auto-reloading class files that works  
> beautifully, and it avoids the class-loading problems that I found  
> Tapestry5DevClassLoader introduced.
> 
> Does anyone know how to auto-reload T5 html templates in JBoss???
> 
> Alternatively, can someone point me to T5.0.5's template 
> scanning class?
> 
> Thanks in advance,
> Geoff
> 
> On 30/09/2007, at 10:01 PM, Ben Sommerville wrote:
> 
> > 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:geoff.callender.jumpstart@gmail.com]
> >> 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 <Gr...@atosorigin.com>
> >>> Reply-To: Tapestry users <us...@tapestry.apache.org>
> >>> To: Tapestry users <us...@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.Tapestry5DevClassL 
> >> o
> >>> 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:thiagohp@gmail.com] 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
> >> <de...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>>
> >> 
> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: the scanner and JBoss

Posted by Robin Helgelin <lo...@gmail.com>.
On 10/3/07, Geoff Callender <ge...@gmail.com> wrote:

Thanks for the tips for Tomcat/JBoss users!

> I haven't got any of this working with .tml files, but maybe they
> aren't supported in T.0.5?

No, 5.0.6-SNAPSHOT only at the momemt.

-- 
        regards,
        Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: the scanner and JBoss

Posted by Geoff Callender <ge...@gmail.com>.
There were a couple of typos in the last post, so here it is again...

Good news for JBoss 4.2.1 with T5.0.5 - I've found there's no need to  
switch to the JBoss classloader to get auto-loading to work.  The  
default classloader works fine if you do this:

1. Set reloadable="true" in the Tomcat context.xml
2. Put classes and templates together in WEB-INF/classes/ in an  
exploded ear/war,
3. Point JBoss at the exploded ear/war or sit the exploded ear/war in  
the JBoss deploy directory.

Whenever you replace a class or template in WEB-INF/classes, you'll  
see in the JBoss log that the Tapestry auto-loader kicks in.

Here's a bit more detail about those steps:

1. Set reloadable="true" in the Tomcat context.xml...
     In your JBoss server's deploy/jboss-web.deployer/context.xml,  
change this...
         <Context cookies="true" crossContext="true">
     to this...
         <Context cookies="true" crossContext="true" reloadable="true">

2. Put classes and templates together in WEB-INF/classes/ in an  
exploded ear/war.

	For example, following the guidelines at http://tapestry.apache.org/ 
tapestry5/tapestry-core/guide/templates.html, the Start page might  
involve this source...
		src/main/java/org/example/myapp/pages/Start.java
		src/main/resources/org/example/myapp/pages/Start.html
	which results in these items in the exploded directory that JBoss  
will scan...
		myapp.ear/myapp.war/WEB-INF/classes/org/example/myapp/pages/ 
Start.class
		myapp.ear/myapp.war/WEB-INF/classes/org/example/myapp/pages/Start.html

     I don't use maven, so in Eclipse I use a custom project builder  
written in Ant to populate the exploded ear/war behind the scenes.

3. Point JBoss at the exploded ear/war or sit the exploded ear/war in  
the JBoss deploy directory.
	You can tell JBoss where to scan by modifying the <attribute  
name="URLs"> section in the server's deploy/conf/jboss-service.xml.

I haven't got any of this working with .tml files, but maybe they  
aren't supported in T.0.5?

HTH
Geoff

On 02/10/2007, at 10:27 AM, Howard Lewis Ship wrote:


> We should probably update the deployment notes for JBoss then.   
> Perhaps
> JBoss has changed recently because I tried a lot of variations  
> before I
> found one that worked properly.
>
> On 10/1/07, Ben Sommerville <be...@bulletproof.com.au> wrote:
>
>>
>> Switching to the JBoss classloader also makes auto-loading of html
>> templates
>> work for me.
>>
>> Have you tried the html auto-loading after making the classloader  
>> change?
>>
>> cheers
>> Ben
>>
>>
>>
>>> -----Original Message-----
>>> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com]
>>> Sent: Monday, 1 October 2007 6:52 AM
>>> To: Tapestry users
>>> Subject: Re: T5: the scanner and JBoss
>>>
>>> Nice one, Ben.  For auto-reloading class files that works
>>> beautifully, and it avoids the class-loading problems that I found
>>> Tapestry5DevClassLoader introduced.
>>>
>>> Does anyone know how to auto-reload T5 html templates in JBoss???
>>>
>>> Alternatively, can someone point me to T5.0.5's template
>>> scanning class?
>>>
>>> Thanks in advance,
>>> Geoff
>>>
>>> On 30/09/2007, at 10:01 PM, Ben Sommerville wrote:
>>>
>>>
>>>> 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:geoff.callender.jumpstart@gmail.com]
>>>>> 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 <Gr...@atosorigin.com>
>>>>>> Reply-To: Tapestry users <us...@tapestry.apache.org>
>>>>>> To: Tapestry users <us...@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.Tapestry5DevClass 
>>> L
>>>
>>>>> o
>>>>>
>>>>>> 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:thiagohp@gmail.com] 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
>>>>>>
>>>>> <de...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
> -- 
> Howard M. Lewis Ship
> Partner and Senior Architect at Feature50
>
> Creator Apache Tapestry and Apache HiveMind
>




Re: T5: the scanner and JBoss

Posted by Geoff Callender <ge...@gmail.com>.
Good news for JBoss 4.2.1 with T5.0.5 - I've found there's no need to  
switch to the JBoss classloader to get auto-loading to work.  The  
default classloader works fine if you do this:

1. Set reloadable="true" in the Tomcat context.xml
2. Put classes and templates together in WEB-INF/classes/ In the  
exploded ear/war,
3. Point JBoss at your exploded ear/war or sit the exploded ear/war  
in the JBoss deploy directory.

Whenever you replace a class or template in WEB-INF/classes, you'll  
see in the JBoss log that the Tapestry auto-loader kicks in.

Here's a bit more detail about those steps:

1. Set reloadable="true" in the Tomcat context.xml...
     In your JBoss server's deploy/jboss-web.deployer/context.xml,  
change this...
         <Context cookies="true" crossContext="true">
     to this...
         <Context cookies="true" crossContext="true" reloadable="true">

2. Put classes and templates together in WEB-INF/classes/ In the  
exploded ear/war.

	For example, following the guidelines at http://tapestry.apache.org/ 
tapestry5/tapestry-core/guide/templates.html, the Start page might  
involve this source...
		src/main/java/org/example/myapp/pages/Start.java
		src/main/java/org/example/myapp/pages/Start.html
	which results in these items in the exploded directory that JBoss  
will scan...
		myapp.ear/myapp.war/WEB-INF/classes/org/example/myapp/pages/ 
Start.class
		myapp.ear/myapp.war/WEB-INF/classes/org/example/myapp/pages/Start.html

     I don't use maven, so in Eclipse I use a custom project builder  
written in Ant to populate the exploded ear/war behind the scenes.

3. Point JBoss at your exploded ear/war or sit the exploded ear/war  
in the JBoss deploy directory.
	You can tell JBoss where to scan by modifying the <attribute  
name="URLs"> section in the server's deploy/conf/jboss-service.xml.

HTH
Geoff

On 02/10/2007, at 10:27 AM, Howard Lewis Ship wrote:

> We should probably update the deployment notes for JBoss then.   
> Perhaps
> JBoss has changed recently because I tried a lot of variations  
> before I
> found one that worked properly.
>
> On 10/1/07, Ben Sommerville <be...@bulletproof.com.au> wrote:
>>
>> Switching to the JBoss classloader also makes auto-loading of html
>> templates
>> work for me.
>>
>> Have you tried the html auto-loading after making the classloader  
>> change?
>>
>> cheers
>> Ben
>>
>>
>>> -----Original Message-----
>>> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com]
>>> Sent: Monday, 1 October 2007 6:52 AM
>>> To: Tapestry users
>>> Subject: Re: T5: the scanner and JBoss
>>>
>>> Nice one, Ben.  For auto-reloading class files that works
>>> beautifully, and it avoids the class-loading problems that I found
>>> Tapestry5DevClassLoader introduced.
>>>
>>> Does anyone know how to auto-reload T5 html templates in JBoss???
>>>
>>> Alternatively, can someone point me to T5.0.5's template
>>> scanning class?
>>>
>>> Thanks in advance,
>>> Geoff
>>>
>>> On 30/09/2007, at 10:01 PM, Ben Sommerville wrote:
>>>
>>>> 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:geoff.callender.jumpstart@gmail.com]
>>>>> 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 <Gr...@atosorigin.com>
>>>>>> Reply-To: Tapestry users <us...@tapestry.apache.org>
>>>>>> To: Tapestry users <us...@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.Tapestry5DevClass 
>>> L
>>>>> o
>>>>>> 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:thiagohp@gmail.com] 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
>>>>> <de...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>
>>>>>
>>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> -------------------------------------------------------------------- 
>>> -
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> -- 
> Howard M. Lewis Ship
> Partner and Senior Architect at Feature50
>
> Creator Apache Tapestry and Apache HiveMind


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: the scanner and JBoss

Posted by Howard Lewis Ship <hl...@gmail.com>.
We should probably update the deployment notes for JBoss then.  Perhaps
JBoss has changed recently because I tried a lot of variations before I
found one that worked properly.

On 10/1/07, Ben Sommerville <be...@bulletproof.com.au> wrote:
>
> Switching to the JBoss classloader also makes auto-loading of html
> templates
> work for me.
>
> Have you tried the html auto-loading after making the classloader change?
>
> cheers
> Ben
>
>
> > -----Original Message-----
> > From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com]
> > Sent: Monday, 1 October 2007 6:52 AM
> > To: Tapestry users
> > Subject: Re: T5: the scanner and JBoss
> >
> > Nice one, Ben.  For auto-reloading class files that works
> > beautifully, and it avoids the class-loading problems that I found
> > Tapestry5DevClassLoader introduced.
> >
> > Does anyone know how to auto-reload T5 html templates in JBoss???
> >
> > Alternatively, can someone point me to T5.0.5's template
> > scanning class?
> >
> > Thanks in advance,
> > Geoff
> >
> > On 30/09/2007, at 10:01 PM, Ben Sommerville wrote:
> >
> > > 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:geoff.callender.jumpstart@gmail.com]
> > >> 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 <Gr...@atosorigin.com>
> > >>> Reply-To: Tapestry users <us...@tapestry.apache.org>
> > >>> To: Tapestry users <us...@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.Tapestry5DevClassL
> > >> o
> > >>> 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:thiagohp@gmail.com] 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
> > >> <de...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
> > >>> For additional commands, e-mail: users-help@tapestry.apache.org
> > >>>
> > >>>
> > >>>
> > >>
> > ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > >>> For additional commands, e-mail: users-help@tapestry.apache.org
> > >>>
> > >>
> > >>
> > >>
> > ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > >> For additional commands, e-mail: users-help@tapestry.apache.org
> > >>
> > >>
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

Re: T5: the scanner and JBoss

Posted by Geoff Callender <ge...@gmail.com>.
Yep, that worked!  Many thanks.

For a few moments I thought it was absolutely awesome, but now I  
can't decide if it's awesome or a pain.  It's awesome because it  
means you can keep the templates and java together in the same source  
directories.  It's a pain because your web designers might prefer to  
keep the templates and java separate, and because the templates are  
away from the css and other assets it's harder to achieve one of  
Tapestry's great features - the ability to preview any template in a  
browser..

Your thoughts?

On 02/10/2007, at 10:07 AM, Ben Sommerville wrote:

> Ahh, that would be the difference.
> My templates are under WEB-INF\classes.
>
>> -----Original Message-----
>> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com]
>> Sent: Tuesday, 2 October 2007 6:23 AM
>> To: Tapestry users
>> Subject: Re: T5: the scanner and JBoss
>>
>> Didn't work for me.  My html templates are in subdirectories of WEB-
>> INF.  Where are yours?
>>
>> On 01/10/2007, at 11:53 PM, Ben Sommerville wrote:
>>
>>> Switching to the JBoss classloader also makes auto-loading of html
>>> templates
>>> work for me.
>>>
>>> Have you tried the html auto-loading after making the classloader
>>> change?
>>>
>>> cheers
>>> Ben
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: the scanner and JBoss

Posted by Ben Sommerville <be...@bulletproof.com.au>.
Ahh, that would be the difference.
My templates are under WEB-INF\classes. 

> -----Original Message-----
> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com] 
> Sent: Tuesday, 2 October 2007 6:23 AM
> To: Tapestry users
> Subject: Re: T5: the scanner and JBoss
> 
> Didn't work for me.  My html templates are in subdirectories of WEB- 
> INF.  Where are yours?
> 
> On 01/10/2007, at 11:53 PM, Ben Sommerville wrote:
> 
> > Switching to the JBoss classloader also makes auto-loading of html
> > templates
> > work for me.
> >
> > Have you tried the html auto-loading after making the classloader  
> > change?
> >
> > cheers
> > Ben
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: the scanner and JBoss

Posted by Geoff Callender <ge...@gmail.com>.
Didn't work for me.  My html templates are in subdirectories of WEB- 
INF.  Where are yours?

On 01/10/2007, at 11:53 PM, Ben Sommerville wrote:

> Switching to the JBoss classloader also makes auto-loading of html
> templates
> work for me.
>
> Have you tried the html auto-loading after making the classloader  
> change?
>
> cheers
> Ben
>
>
>> -----Original Message-----
>> From: Geoff Callender [mailto:geoff.callender.jumpstart@gmail.com]
>> Sent: Monday, 1 October 2007 6:52 AM
>> To: Tapestry users
>> Subject: Re: T5: the scanner and JBoss
>>
>> Nice one, Ben.  For auto-reloading class files that works
>> beautifully, and it avoids the class-loading problems that I found
>> Tapestry5DevClassLoader introduced.
>>
>> Does anyone know how to auto-reload T5 html templates in JBoss???
>>
>> Alternatively, can someone point me to T5.0.5's template
>> scanning class?
>>
>> Thanks in advance,
>> Geoff
>>
>> On 30/09/2007, at 10:01 PM, Ben Sommerville wrote:
>>
>>> 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:geoff.callender.jumpstart@gmail.com]
>>>> 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 <Gr...@atosorigin.com>
>>>>> Reply-To: Tapestry users <us...@tapestry.apache.org>
>>>>> To: Tapestry users <us...@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.Tapestry5DevClassL
>>>> o
>>>>> 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:thiagohp@gmail.com] 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
>>>> <de...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org