You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Abhijeet Kahale <ab...@gmail.com> on 2007/02/12 05:37:31 UTC

Problem while Struts 2 and Tiles 2 integration.

Hi All,

I have created a small application to get familiar with the Struts 2 and
Tiles 2 integration.

I am using *struts2-tiles-plugin-2.0.5.jar* , *
tiles-api-2.0-20070130.184344-3.jar* and *
tiles-core-2.0-20070130.184344-3.jar* for the integration. (but the struts
core jar I am using is *struts2-core-2.0.1.jar *)
The dtd i used is http://jakarta.apache.org/struts/dtds/tiles-config_2_0.dtd
I have configured some actions and jsps to use Struts2 APIs and struts/tiles
tags
I am using Tomcat 5 as a web server.

When I start the tomcat, the application loads properly and no error is
thrown while bootstrap.
I even can load my first page which is a simple login page. But when I enter
something and login, I get following exception about the *tiles definition*

*<Exception>*
   *Messages*: I/O Error reading definitions.  *File*:
org/apache/tiles/definition/digester/DigesterDefinitionsReader.java *Line
number*: 164
Stacktraces
org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading
definitions.
    org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(
DigesterDefinitionsReader.java:164)
    org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(
UrlDefinitionsFactory.java:257)

org.apache.tiles.definition.UrlDefinitionsFactory.getComponentDefinitions(
UrlDefinitionsFactory.java:116)
    org.apache.tiles.definition.UrlDefinitionsFactory.getDefinition(
UrlDefinitionsFactory.java:136)
    org.apache.tiles.impl.BasicTilesContainer.getDefinition (
BasicTilesContainer.java:434)
    org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.java:333)
    org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.java:315)
    org.apache.struts2.views.tiles.TilesResult.doExecute (TilesResult.java
:104)
    org.apache.struts2.dispatcher.StrutsResultSupport.execute(
StrutsResultSupport.java:175)
*</Exception>*

The snippet of my tiles-def file is
*<snip>*
<tiles-definitions>
    <definition name="blank" template="/pages/blank.jsp"/> *<!-- Formerly i
tried using "path" attribute also -->*
    <definition name=" earray.masterContent"
template="/pages/MasterWindow.jsp">
        <put name="titlebar" value="/pages/title.jsp"/>
        <put name="header" value="/pages/header.jsp"/>
        <put name="menubar" value="biochipMenu"/>
        <put name="upperbody" value="blank"/>
        <put name="divider" value="blank"/>
        <put name="lowerbody" value="blank"/>
        <put name="footer" value="blank"/>
    </definition>
    <definition name="earray.homepage" extends="earray.masterContent">
        <put name="upperbody" value="/pages/homePage.jsp"/>
    </definition>
</tiles-definitions>
*</snip>*
And the snipped from my struts.xml is.
*<snip>*
<struts>
    <package name="" namespace="/" extends="struts-default">
        <result-types>
            <result-type name="tiles" class="
org.apache.struts2.views.tiles.TilesResult"/>
        </result-types>
        <action name="Login" class="sample.Login">
            <result type="redirect">topMenu.action</result>
        </action>
        <action name="landingPage" class=" sample.Login" method="show">
            <result>/pages/login.jsp</result>
        </action>
        <action name="topMenu" class="sample.topmostMenu" >
            <result type="tiles">earray.homepage</result>
        </action>
    </package >
</struts>
*</snip>*
I even configured the *org.apache.struts2.tiles.StrutsTilesListener* in the
web.xml
Can anybody help me out?

One more thing I want to know is which tiles taglib should i use? First i
used the one which I used for struts 1-tiles 1 integration. Then I tried
without specifying any tld configuration in web.xml at all. (becoz in the
examples i searched, i didnt find anyone specifying it.)

Thanks an Regards,
Abhijeet.

RE: Problem while Struts 2 and Tiles 2 integration.

Posted by LAMY Olivier <Ol...@accor.com>.
Hi,
Have a look : https://issues.apache.org/struts/browse/TILES-183

HTH,
--
Olivier 

-----Message d'origine-----
De : Kev_dev [mailto:guyincognito01@hotmail.com] 
Envoyé : samedi 16 juin 2007 19:57
À : user@struts.apache.org
Objet : Re: Problem while Struts 2 and Tiles 2 integration.


I received this error as well, and discovered the cause to actually be my tiles.xml.  The Struts2 tiles.xml needs to follow the schema defined in "http://struts.apache.org/dtds/tiles-config_2_0.dtd", and if your tiles.xml differs from it, you may receive this exception.  In my case, I was porting over a struts1 tiles.xml, and missed one of the syntax changes. So I had:

<definition name="2colLayout" path="/WEB-INF/templates/2col.jsp">

instead of:

<definition name="2colLayout" template="/WEB-INF/templates/2col.jsp">

for one of my entries.  So when the tiles plugin wanted to open my actual layout page, it did not see the correct entry for it (it did not see the tag "template="), and threw the I/O exception.  Double check your tiles.xml and ensure that it has the correct syntax for struts2 tiles.

You may not have noticed the syntax error if you were using an IDE (which should have validated your XML for you), because the "http://struts.apache.org/dtds/tiles-config_2_0.dtd" doesn't actually exist! 
It looks like apache forgot to put in on their site, so you won't know of your syntax issues until runtime.
--
View this message in context: http://www.nabble.com/Problem-while-Struts-2-and-Tiles-2-integration.-tf3211632.html#a11156554
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
********************************************************************** 
Ce message électronique et tous les fichiers joints ainsi que  les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la  personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci  de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
********************************************************************** 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Kev_dev <gu...@hotmail.com>.
I received this error as well, and discovered the cause to actually be my
tiles.xml.  The Struts2 tiles.xml needs to follow the schema defined in
"http://struts.apache.org/dtds/tiles-config_2_0.dtd", and if your tiles.xml
differs from it, you may receive this exception.  In my case, I was porting
over a struts1 tiles.xml, and missed one of the syntax changes. So I had:

<definition name="2colLayout" path="/WEB-INF/templates/2col.jsp">

instead of:

<definition name="2colLayout" template="/WEB-INF/templates/2col.jsp">

for one of my entries.  So when the tiles plugin wanted to open my actual
layout page, it did not see the correct entry for it (it did not see the tag
"template="), and threw the I/O exception.  Double check your tiles.xml and
ensure that it has the correct syntax for struts2 tiles.

You may not have noticed the syntax error if you were using an IDE (which
should have validated your XML for you), because the
"http://struts.apache.org/dtds/tiles-config_2_0.dtd" doesn't actually exist! 
It looks like apache forgot to put in on their site, so you won't know of
your syntax issues until runtime.
-- 
View this message in context: http://www.nabble.com/Problem-while-Struts-2-and-Tiles-2-integration.-tf3211632.html#a11156554
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Greg Reddin <gr...@gmail.com>.
On 2/15/07, Greg Reddin <gr...@gmail.com> wrote:
>
> I would suspect that your problem lies in one of two areas:
>
> 1)  Your web app is not configured correctly.


Sorry, I may not have been very clear about this.  Your web app may likely
not be configured to match the build of Tiles you are using.  Check the
web.xml and see if it matches the link below.  If not you may either need to
change your web.xml or move to a different build of Tiles.


    http://svn.apache.org/repos/asf/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
>


Greg

Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Greg Reddin <gr...@gmail.com>.
I would suspect that your problem lies in one of two areas:

1)  Your web app is not configured correctly.
2)  You're not using a build of Tiles 2 that is compatible with the version
of Struts.

I didn't see the exception you posted so it's hard to determine which.  I'll
check the archives if I get a chance today.

Most people seem to be finding success by following the example of the
tiles-test webapp:

    http://svn.apache.org/repos/asf/tiles/framework/trunk/tiles-test/

and:


http://svn.apache.org/repos/asf/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml

HTH,
Greg

Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Abhijeet Kahale <ab...@gmail.com>.
On 2/15/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- Abhijeet Kahale <ab...@gmail.com> wrote:
> > > > I am using *struts2-tiles-plugin-2.0.5.jar* , *
> > > > > tiles-api-2.0-20070130.184344-3.jar* and *
> > > > > tiles-core-2.0-20070130.184344-3.jar* for the
> > > > integration. (but the struts
> > > > > core jar I am using is *struts2-core-2.0.1.jar
> > *)
> > >
> > > Why are you using 2.0.1 core and 2.0.5 tiles
> > plugin?
> > > This strikes me as being a bad idea, although I'll
> > > admit trying it never really crossed my mind.
> >
> >
> > I tried with struts2-core-2.0.1.jar, but it's still
> > not working.
>
> Did you mean 2.0.5?


:-) yes, my mistake, I replied over it after. Neway.

Are you positive you have all the correct jars? It'd
> probably be better if they were all from the same
> release.


I am using following jars :-
antlr-2.7.2.jar
cocoon.jar
commons-beanutils-1.7.0.jar
commons-chain-1.1.jar
commons-collections-3.1.jar
commons-digester.jar
commons-fileupload.jar
commons-lang-2.1.jar
commons-logging-1.0.4.jar
commons-validator-1.3.0.jar
freemarker-2.3.8.jar
ognl-2.6.9.jar
oro-2.0.8.jar
spring-aop-1.2.8.jar
spring-beans-1.2.8.jar
spring-context-1.2.8.jar
spring-core-1.2.8.jar
spring-web-1.2.8.jar
struts-core-1.3.5.jar
struts2-api-2.0.5.jar
struts2-config-browser-plugin-2.0.5.jar
struts2-core-2.0.5.jar
struts2-struts1-plugin-2.0.5.jar
struts2-tiles-plugin-2.0.5.jar
tiles-api-2.0-20070130.184344-3.jar
tiles-core-2.0-20070130.184344-3.jar
xalan-2.4.0.jar
xalan_1_2_D02.jar
xerces-2.4.0.jar
xml-apis.jar
xwork-2.0.0.jar

Is your tiles file actually getting deployed?

here is the snippet from the Tomcat log which shows tiles container is
initialized properly.
<snip>
Feb 15, 2007 10:18:39 AM
org.springframework.web.context.ContextLoaderinitWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 609 ms
Feb 15, 2007 10:18:39 AM org.apache.tiles.impl.BasicTilesContainer init
INFO: Initializing Tiles2 container. . .
Feb 15, 2007 10:18:39 AM
org.apache.tiles.impl.BasicTilesContainerinitializeDefinitionsFactory
INFO: Tiles2 container initialization complete.
Feb 15, 2007 10:18:39 AM org.apache.tiles.access.TilesAccess setContainer
INFO: Publishing TilesContext for context:
org.apache.catalina.core.ApplicationContextFacade
Feb 15, 2007 10:18:43 AM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-default.xml]

</snip>


d.
>

Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Abhijeet Kahale <ab...@gmail.com>.
Sorry, my mistake, please read " tried with struts2-core-2.0.1.jar, but it's
still not working" as " tried with struts2-core-2.0.5.jar, but it's still
not working"

On 2/15/07, Abhijeet Kahale <ab...@gmail.com> wrote:
>
>
>
> On 2/14/07, Dave Newton <ne...@yahoo.com> wrote:
> >
> > --- Abhijeet Kahale <ab...@gmail.com> wrote:
> > > Can anyone please help?
> > > I am waiting for a response...
> >
> > Oh, my bad.
>
>
> Thnx for the response.
>
> > > I am using *struts2-tiles-plugin-2.0.5.jar* , *
> > > > tiles-api-2.0-20070130.184344-3.jar* and *
> > > > tiles-core-2.0-20070130.184344-3.jar* for the
> > > integration. (but the struts
> > > > core jar I am using is *struts2-core-2.0.1.jar *)
> >
> > Why are you using 2.0.1 core and 2.0.5 tiles plugin?
> > This strikes me as being a bad idea, although I'll
> > admit trying it never really crossed my mind.
>
>
> I tried with struts2-core-2.0.1.jar, but it's still not working.
>
> > > *<Exception>*
> > > >    *Messages*: I/O Error reading definitions.
> >
> > That sure looks suspicious, huh.
>
>
> Getting the same exception with the new jar also.
>
> > > The snippet of my tiles-def file is
> > > > *<snip>*
> > > > <tiles-definitions>
> > > >     <definition name="blank"
> > > > [...]
> >
> > What's the name of your tiles configuration file and
> > where is it located?
>
>
> I am using tiles.xml and put it under WEB-INF/
>
> > > I even configured the
> > > *org.apache.struts2.tiles.StrutsTilesListener* in
> > > > the web.xml
> > > > Can anybody help me out?
> > > >
> > > > One more thing I want to know is which tiles
> > > > taglib should i use?
> >
> > The one that comes with Tiles 2.
>
>
> Ok, using that only, just wanted to confirm.
>
> >> Then I tried without specifying any tld
> > configuration in
> > > web.xml at all.
> >
> > Good; that hasn't been necessary for awhile now.
> >
> > d.
>
>
>
>
>
>

Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Dave Newton <ne...@yahoo.com>.
--- Abhijeet Kahale <ab...@gmail.com> wrote:
> > > I am using *struts2-tiles-plugin-2.0.5.jar* , *
> > > > tiles-api-2.0-20070130.184344-3.jar* and *
> > > > tiles-core-2.0-20070130.184344-3.jar* for the
> > > integration. (but the struts
> > > > core jar I am using is *struts2-core-2.0.1.jar
> *)
> >
> > Why are you using 2.0.1 core and 2.0.5 tiles
> plugin?
> > This strikes me as being a bad idea, although I'll
> > admit trying it never really crossed my mind.
> 
> 
> I tried with struts2-core-2.0.1.jar, but it's still
> not working.

Did you mean 2.0.5?

Are you positive you have all the correct jars? It'd
probably be better if they were all from the same
release.

Is your tiles file actually getting deployed?

d.



 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Abhijeet Kahale <ab...@gmail.com>.
On 2/14/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- Abhijeet Kahale <ab...@gmail.com> wrote:
> > Can anyone please help?
> > I am waiting for a response...
>
> Oh, my bad.


Thnx for the response.

> > I am using *struts2-tiles-plugin-2.0.5.jar* , *
> > > tiles-api-2.0-20070130.184344-3.jar* and *
> > > tiles-core-2.0-20070130.184344-3.jar* for the
> > integration. (but the struts
> > > core jar I am using is *struts2-core-2.0.1.jar *)
>
> Why are you using 2.0.1 core and 2.0.5 tiles plugin?
> This strikes me as being a bad idea, although I'll
> admit trying it never really crossed my mind.


I tried with struts2-core-2.0.1.jar, but it's still not working.

> > *<Exception>*
> > >    *Messages*: I/O Error reading definitions.
>
> That sure looks suspicious, huh.


Getting the same exception with the new jar also.

> > The snippet of my tiles-def file is
> > > *<snip>*
> > > <tiles-definitions>
> > >     <definition name="blank"
> > > [...]
>
> What's the name of your tiles configuration file and
> where is it located?


I am using tiles.xml and put it under WEB-INF/

> > I even configured the
> > *org.apache.struts2.tiles.StrutsTilesListener* in
> > > the web.xml
> > > Can anybody help me out?
> > >
> > > One more thing I want to know is which tiles
> > > taglib should i use?
>
> The one that comes with Tiles 2.


Ok, using that only, just wanted to confirm.

>> Then I tried without specifying any tld
> configuration in
> > web.xml at all.
>
> Good; that hasn't been necessary for awhile now.
>
> d.

Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Dave Newton <ne...@yahoo.com>.
--- Abhijeet Kahale <ab...@gmail.com> wrote:
> Can anyone please help?
> I am waiting for a response...

Oh, my bad.

> > I am using *struts2-tiles-plugin-2.0.5.jar* , *
> > tiles-api-2.0-20070130.184344-3.jar* and *
> > tiles-core-2.0-20070130.184344-3.jar* for the
> integration. (but the struts
> > core jar I am using is *struts2-core-2.0.1.jar *)

Why are you using 2.0.1 core and 2.0.5 tiles plugin?
This strikes me as being a bad idea, although I'll
admit trying it never really crossed my mind.

> > *<Exception>*
> >    *Messages*: I/O Error reading definitions. 

That sure looks suspicious, huh.

> > The snippet of my tiles-def file is
> > *<snip>*
> > <tiles-definitions>
> >     <definition name="blank"
> > [...]

What's the name of your tiles configuration file and
where is it located?

> > I even configured the
> *org.apache.struts2.tiles.StrutsTilesListener* in
> > the web.xml
> > Can anybody help me out?
> >
> > One more thing I want to know is which tiles
> > taglib should i use? 

The one that comes with Tiles 2.

>> Then I tried without specifying any tld
configuration in
> web.xml at all. 

Good; that hasn't been necessary for awhile now.

d.



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem while Struts 2 and Tiles 2 integration.

Posted by Abhijeet Kahale <ab...@gmail.com>.
Can anyone please help?
I am waiting for a response...


On 2/12/07, Abhijeet Kahale <ab...@gmail.com> wrote:
>
> Hi All,
>
> I have created a small application to get familiar with the Struts 2 and
> Tiles 2 integration.
>
> I am using *struts2-tiles-plugin-2.0.5.jar* , *
> tiles-api-2.0-20070130.184344-3.jar* and *
> tiles-core-2.0-20070130.184344-3.jar* for the integration. (but the struts
> core jar I am using is *struts2-core-2.0.1.jar *)
> The dtd i used is http://jakarta.apache.org/struts/dtds/tiles-config_2_0.dtd
>
> I have configured some actions and jsps to use Struts2 APIs and
> struts/tiles tags
> I am using Tomcat 5 as a web server.
>
> When I start the tomcat, the application loads properly and no error is
> thrown while bootstrap.
> I even can load my first page which is a simple login page. But when I
> enter something and login, I get following exception about the *tiles
> definition*
>
> *<Exception>*
>    *Messages*: I/O Error reading definitions.  *File*:
> org/apache/tiles/definition/digester/DigesterDefinitionsReader.java *Line
> number*: 164
> Stacktraces
> org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading
> definitions.
>     org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(
> DigesterDefinitionsReader.java:164)
>     org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(
> UrlDefinitionsFactory.java:257)
>
> org.apache.tiles.definition.UrlDefinitionsFactory.getComponentDefinitions(
> UrlDefinitionsFactory.java:116)
>     org.apache.tiles.definition.UrlDefinitionsFactory.getDefinition(
> UrlDefinitionsFactory.java:136)
>     org.apache.tiles.impl.BasicTilesContainer.getDefinition (
> BasicTilesContainer.java:434)
>     org.apache.tiles.impl.BasicTilesContainer.render(
> BasicTilesContainer.java:333)
>     org.apache.tiles.impl.BasicTilesContainer.render(
> BasicTilesContainer.java:315)
>     org.apache.struts2.views.tiles.TilesResult.doExecute (TilesResult.java
> :104)
>     org.apache.struts2.dispatcher.StrutsResultSupport.execute(
> StrutsResultSupport.java:175)
> *</Exception>*
>
> The snippet of my tiles-def file is
> *<snip>*
> <tiles-definitions>
>     <definition name="blank" template="/pages/blank.jsp"/> *<!-- Formerly
> i tried using "path" attribute also -->*
>     <definition name=" earray.masterContent"
> template="/pages/MasterWindow.jsp">
>         <put name="titlebar" value="/pages/title.jsp"/>
>         <put name="header" value="/pages/header.jsp"/>
>         <put name="menubar" value="biochipMenu"/>
>         <put name="upperbody" value="blank"/>
>         <put name="divider" value="blank"/>
>         <put name="lowerbody" value="blank"/>
>         <put name="footer" value="blank"/>
>     </definition>
>     <definition name="earray.homepage" extends="earray.masterContent">
>         <put name="upperbody" value="/pages/homePage.jsp"/>
>     </definition>
> </tiles-definitions>
> *</snip>*
> And the snipped from my struts.xml is.
> *<snip>*
> <struts>
>     <package name="" namespace="/" extends="struts-default">
>         <result-types>
>             <result-type name="tiles" class="
> org.apache.struts2.views.tiles.TilesResult"/>
>         </result-types>
>         <action name="Login" class="sample.Login">
>             <result type="redirect">topMenu.action</result>
>         </action>
>         <action name="landingPage" class=" sample.Login" method="show">
>             <result>/pages/login.jsp</result>
>         </action>
>         <action name="topMenu" class="sample.topmostMenu" >
>             <result type="tiles">earray.homepage</result>
>         </action>
>     </package >
> </struts>
> *</snip>*
> I even configured the *org.apache.struts2.tiles.StrutsTilesListener* in
> the web.xml
> Can anybody help me out?
>
> One more thing I want to know is which tiles taglib should i use? First i
> used the one which I used for struts 1-tiles 1 integration. Then I tried
> without specifying any tld configuration in web.xml at all. (becoz in the
> examples i searched, i didnt find anyone specifying it.)
>
> Thanks an Regards,
> Abhijeet.
>