cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Bug in TreeProcessor sitemap reloading?
Date Mon, 15 Apr 2002 17:25:28 GMT
Vadim Gritsenko wrote:

>>Vadim Gritsenko wrote:
>>>Hi all,
>>>Is this an undiscovered bug in the TreeProcessor?
>>>0. Go to http://localhost:8080/cocoon/formvalidation/test
>>>1. Hit "submit"
>>>2. Touch sitemap.xmap
>>>3. Hit "submit"
>>>4. Get "java.lang.IllegalStateException: You cannot lookup components
>>>on a disposed ComponentManager"
>>>XSP page never gets new component manager on the sitemap
>>This seems to be a bug in the way the XSP engine handles CMs : 
>>ServerPagesGenerator calls ProgramGenerator.load() with its own CM, 
>>which is then propagated down to JavaProgram which uses it to create a ComponentHandler
for the compiled XSP. The XSP is then stored in the 
>>ProgramGenerator cache.
>It seems to me that the bug not in the XSP engine but in the program
>generator. May be it should return component handler instead of trying
>to manage components by itself? Consider scenario: same XSP page is used
>in two sitemaps, but these two sitemaps have different component which
>is looked up by XSP. In current implementation, XSP will get this
>component from the sitemap who invoked this XSP first.
>If program generator returns handler, then every sitemap will get
>handler for this XSP, with different manager -> XSP will lookup correct
>component from the correct sitemap. And, on sitemap reload, this handler
>will be disposed by the sitemap.

Mmmh... I'm not sure this will solve the problem : upon creation, the 
component handler creates a pool of XSP instaces and compose them with 
the CM it is given. Or did I miss something ? Do you want to create one 
component handler (and thus one pool) for each CM ?

We have to consider here the fact that component lookup in XSP user code 
occurs within the generate() method, and thus after both compose() and 
recompose(). So composing with the root CM and recomposing with the 
sitemap's CM should be OK.

>>Now the CM in ServerPagesGenerator is the local CM of the sitemap, 
>>created with the contents of <map:components>. When the sitemap is 
>>reloaded, this CM is disposed and a new one is created. But the cached XSP still references
the previous CM which is now disposed.
>>This bug doesn't exist in the compiled engine because a compiled sitemap doesn't have
a local CM, but only a set of selectors for each component type and thus the XSP uses Cocoon's
root CM.
>>IMO, to solve this problem, the ProgramGenerator should use its own CM (i.e. Cocoon's
root CM) to get a ComponentHandler and then make  XSPGenerator (or AbstractServerPage?) recomposable
so that it gets the correct sitemap CM.
>This does not work for sitemap compilation: it must be created with
>parent sitemap manager in order to inherit components configured in the
>I rolled back some of the changes - but left recomposable.

What about moving the code in AbstractSitemap.compose() to 
AbstractSitemap.recompose(), or even initialize() to handle the 
hypothetical case where recompose() isn't called ? Won't this solve the 
problem ?

>>Thoughts ? Does this affect also the JavaScript XSP engine ?
>Yes - if XSP needs to get some component.

So it needs to be made recomposable also.


Sylvain Wallez
 Anyware Technologies                  Apache Cocoon 

To unsubscribe, e-mail:
For additional commands, email:

View raw message