You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Enrico Migliore <en...@fatti.com> on 2004/05/31 12:09:23 UTC

Re: Cocoon 2.1.5 - javaflow problem (6.2)

Stephan Michels wrote:

>On Sat, 29 May 2004, Enrico Migliore wrote:
>
>  
>
>>Dear Stephan
>>
>> I may have spot where the problem is. In the following file:
>>
>>               .\cocoon-2.1.5\src\blocks\javaflow\TODO.txt
>>
>>I found the following script:
>>
>>----------------------------------------------------------------------------
>> What is left to do?
>> -------------------
>> - allow the ability to reload the java flow classes using for example the
>>   CompilingClassLoader.
>>----------------------------------------------------------------------------
>>
>>Does that mean that, at the moment, it's not possible to reload a class
>>at runtime?
>>    
>>
>
>Yes, that's true. But this depends on the reloading behaviour of the
>servlet classloader. If a class changed and the servlet container
>reload the whole servlet then there won't be a problem. But
>if it doesn't reload the servlet then the ContinuationClassloader will
>stick to the previous class.
>
>I think that your problem can be solved, but I never tested the reloading
>behaviour of jetty, because I don't know how to activate it.
>
>Stephan
>

Dear Stephan,

 I'm investingating about how to instruct Jetty to reload a servlet, and
 eventually I will post to the mailing list the result, in case of success.

 I got just one dubt:  if I reload the Cocoon servlet at each client's 
request,
 all new classes' instances will forget completely their previous history:
 continuations, the value of all instance variables...am I right?

 thanks again for your help
 Enrico





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


Cocoon 2.1.5 - javaflow problem - solved!

Posted by Enrico Migliore <en...@fatti.com>.
Hi guys,

 I had the following problem:

  "Cocoon 2.1.5 java-flow block doesn't reload .class files"

The result of that was that each time I made a modification to a class
file of my web application, I had to restart Cocoon.
Here's how I solved the problem:
------------------------------------------------------------------------

 I modified the "JavaInterpreter.java" file in order for Cocoon to reload
 a .class file when it detects a modification in time.
 Please, read the following instructions:

 1. Before running Cocoon, you need to set the environment variable
     COCOON_HOME to the absolute path of your installation.
     I'm using a batch file with the following content:

        set COCOON_HOME="D:\Programmi\cocoon\cocoon-2.1.53"
        cocoon servlet

     Cocoon, on my PC, is indeed installed in 
"D:\Programmi\cocoon\cocoon-2.1.53"
   
2. I posted the modified: "JavaInterpreter.java" and 
"cocoon-javaflow-block.jar"
    files at the following URL

                 http://www.foskeea.org/cocoon/javaflow-modified.zip

3. The modifications I made are meant for debug purposes only.
    Because, the current release of Cocoon (2.1.5) doesn't
    reload .class files.
    I used the "File.separator" field in order for the modifications to run
    on any platform.
   
4. Each time you modify a .class file, please have your URL point to
    the initial URI of your web application, to start fresh a new debug 
session.
   

I'm using it and hope it'll help others,

 ciao
 Enrico

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


Re: Cocoon 2.1.5 - javaflow problem (6.3) - solved!

Posted by Enrico Migliore <en...@fatti.com>.
Upayavira wrote:

> Wow. You really must not reload the cocoon servlet at each request. 
> The servlet does a lot of things like initialising loads of avalon 
> objects, etc. If you did that at every request, you can expect your 
> servlet container to die very quickly.
>
> Jetty can reload a class if you compile it while at a breakpoint, I 
> use that regularly. But to have it reload when a class has changed 
> would be really neat.
>
> Regards, Upayavira
>
Dear Upayavira,

 I modified the "JavaInterpreter.java" file in order for Cocoon to 
reload a .class file
 when it detects a modification in time. Please, read the following 
instructions, in case
 you want to try it

 1. Before running Cocoon, you need to set the environment variable 
COCOON_HOME
     to the absolute path of your installation. I'm using a batch file 
with the following
     content:

          set COCOON_HOME="D:\Programmi\cocoon\cocoon-2.1.53"
          cocoon servlet

     Cocoon, on my PC, is indeed installed in 
"D:\Programmi\cocoon\cocoon-2.1.53"
   
2. I posted the modified: "JavaInterpreter.java" and 
"cocoon-javaflow-block.jar"
    files at the following URL

                 http://www.foskeea.org/cocoon/javaflow-modified.zip

3. The modifications I made are meant for debug purposes only. Because, 
as you
    know, the current release of Cocoon (2.1.5) doesn't reload .class files.
    I used the "File.separator" field in order for the modifications to 
run on any
    platform.
   

4. Each time you modify a .class file, please have your URL point to the 
initial URI
    of your web application, to start fresh a new debug session.
   

I'm using it and hope it'll help others,

 ciao
 Enrico


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


Re: Cocoon 2.1.5 - javaflow problem (6.2)

Posted by Upayavira <uv...@upaya.co.uk>.
Enrico Migliore wrote:

> Stephan Michels wrote:
>
>> On Sat, 29 May 2004, Enrico Migliore wrote:
>>
>>  
>>
>>> Dear Stephan
>>>
>>> I may have spot where the problem is. In the following file:
>>>
>>>               .\cocoon-2.1.5\src\blocks\javaflow\TODO.txt
>>>
>>> I found the following script:
>>>
>>> ---------------------------------------------------------------------------- 
>>>
>>> What is left to do?
>>> -------------------
>>> - allow the ability to reload the java flow classes using for 
>>> example the
>>>   CompilingClassLoader.
>>> ---------------------------------------------------------------------------- 
>>>
>>>
>>> Does that mean that, at the moment, it's not possible to reload a class
>>> at runtime?
>>>   
>>
>>
>> Yes, that's true. But this depends on the reloading behaviour of the
>> servlet classloader. If a class changed and the servlet container
>> reload the whole servlet then there won't be a problem. But
>> if it doesn't reload the servlet then the ContinuationClassloader will
>> stick to the previous class.
>>
>> I think that your problem can be solved, but I never tested the 
>> reloading
>> behaviour of jetty, because I don't know how to activate it.
>>
>> Stephan
>>
>
> Dear Stephan,
>
> I'm investingating about how to instruct Jetty to reload a servlet, and
> eventually I will post to the mailing list the result, in case of 
> success.
>
> I got just one dubt:  if I reload the Cocoon servlet at each client's 
> request,
> all new classes' instances will forget completely their previous history:
> continuations, the value of all instance variables...am I right?

Wow. You really must not reload the cocoon servlet at each request. The 
servlet does a lot of things like initialising loads of avalon objects, 
etc. If you did that at every request, you can expect your servlet 
container to die very quickly.

Jetty can reload a class if you compile it while at a breakpoint, I use 
that regularly. But to have it reload when a class has changed would be 
really neat.

Regards, Upayavira



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