hi all,

i'm new to tiles2 and currently trying hard to get it working within my spring 
enabled web application.
actually almost the hole thing is working proper with one exception.

tiles2 crashes while it reads the definitions from the definitionsFile(s) i 
told it to read from within the following circumstances:

    1. start the tomcat servlet container.
    2. no request sent to tomcat since startup.
    3. sending multiple request using a web application test application 
simultaneously.

if i do this, a realy big number of exceptions occurre inside of tomcat. 
investigating those exceptions i figured out, that there is a problem when the 
definitions are getting read from the xml string held inside tiles. as far as i 
can see, those definitions are then getting read using digester. as i can see, 
reading the definitions is neither synchronized nor is it using independent 
instances (thread bounded) of the class it is using for this purpose.

the result is, that the different threads are messing with each other and the 
process of loading the definitions crashs.

if i use it the following way, everything works proper:

    1. start the tomcat servlet container.
    2. send one single request to it at least.
    3. send as many request simultanously as the server can handle.

interessting, isn't it?

---------------------------------------------------

how i use tiles2:

i do not use any of tiles' servlets, listeners, ... i initialize tiles the 
programmatical way by using the spring framework's TilesConfigurer introduced 
in its version 2.1 m4. in general it is first setting up servlet initial 
parameters that are defining the several factory, preparer, ... implementations 
to use by tiles.

after that it initializes the tiles framework the following way:
public void afterPropertiesSet() throws TilesException {

    TilesContainer container = createTilesContainer(this.servletContext);

    TilesAccess.setContainer(this.servletContext, container);

}

protected TilesContainer createTilesContainer(ServletContext context) throws 
TilesException {

    ServletContextAdapter adaptedContext = new ServletContextAdapter(new 
DelegatingServletConfig());

    TilesContainerFactory factory = 
TilesContainerFactory.getFactory(adaptedContext);

    return factory.createContainer(adaptedContext);

}

where afterPropertiesSet() is the method which needs to be invoked in order to 
initialize tiles. DelegatingServletConfig is a simple inner class of 
TilesConfigurer which makes the configurer's settings according to the 
factory/preparer/... implementations to use by tiles available as initial 
servlet property settings.

can anyone confirm that this is a bug within tiles2 or is it just me, who's 
using tiles the wrong way?

thx a lot, greez,

dirk

Reply via email to