You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Johann Romefort <ro...@club-internet.fr> on 2003/09/29 14:45:47 UTC

Class reloading in flow

Hi,

I would like to know if there is some way to enable class reloading for 
import called from the FlowScript, without restarting Tomcat?

Thanks in advance,

Johann


Re: Class reloading in flow

Posted by Christopher Oliver <re...@verizon.net>.
Some people might consider this an abuse, but for the record Rhino 
supports using custom class loaders via the Packages() constructor:

// create a custom class loader
var cl = new java.net.URLClassLoader([new java.net.URL("file:./foo.jar")],
                                                            
 java.lang.Thread.currentThread().getContextClassLoader());

// create a new "Packages" object encapsulating the class loader:
var fooJar = new Packages(cl);

// use classes from foo.jar:
importClass(fooJar.baz.Foo);

var foo = new Foo(1, 2, 3);
foo.someMethod();

Johann Romefort wrote:

> Hi,
>
> I would like to know if there is some way to enable class reloading 
> for import called from the FlowScript, without restarting Tomcat?
>
> Thanks in advance,
>
> Johann
>
>



Re: Class reloading in flow

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Johann Romefort wrote:

> Hi,
>
> I would like to know if there is some way to enable class reloading 
> for import called from the FlowScript, without restarting Tomcat?


Nope, there's no way... But can't you use Tomcat's manager to 
stop/restart the application context ? I guess (but did not test it) 
that it may reload whole webapp.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



RE: Class reloading in flow

Posted by Reinhard Poetz <re...@apache.org>.
From: Sylvain Wallez

> 
> Reinhard Poetz wrote:
> 
> >From: Johann Romefort
> > 
> >  
> >
> >>Hi,
> >>
> >>I would like to know if there is some way to enable class reloading 
> >>for import called from the FlowScript, without restarting Tomcat?
> >>    
> >>
> >
> >I think this has nothing to do with FlowScript or not - you have to 
> >setup your servlet container in a way that it supports (e.g. for 
> >Tomcat: set the reloadable attribute to 'true').
> >
> 
> I sometimes had some weird problems with the reloadable flag, as it 
> doesn't clean Session attributes, which leads to ClassCastExceptions 
> when newly reloaded classes got them. At least that was the case with 
> the version I used when I decided to not use this feature ;-)

Yep, I sometimes have some very strange results too ... and sometimes I
don't know whether Tomcat already uses the changed or new classes or
not.

Reinhard


Re: Class reloading in flow

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Reinhard Poetz wrote:

>From: Johann Romefort
> 
>  
>
>>Hi,
>>
>>I would like to know if there is some way to enable class reloading for import called from the FlowScript, without restarting Tomcat?
>>    
>>
>
>I think this has nothing to do with FlowScript or not - you have to setup your servlet container in a way that it supports (e.g. for Tomcat: set the reloadable attribute to 'true').
>

I sometimes had some weird problems with the reloadable flag, as it 
doesn't clean Session attributes, which leads to ClassCastExceptions 
when newly reloaded classes got them. At least that was the case with 
the version I used when I decided to not use this feature ;-)

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



RE: Class reloading in flow

Posted by Reinhard Poetz <re...@apache.org>.
From: Johann Romefort
 
> Hi,
> 
> I would like to know if there is some way to enable class 
> reloading for 
> import called from the FlowScript, without restarting Tomcat?

I think this has nothing to do with FlowScript or not - you have to
setup your servlet container in a way that it supports (e.g. for Tomcat:
set the reloadable attribute to 'true').

Reinhard