You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by "dave@nr" <da...@northernrock.co.uk> on 2007/01/24 18:09:51 UTC
Integrating JSF and Shale Tiles
I've tried to use the shale-framework-1.0.4.zip file and have hit a problem
that I was wondering if anyone could help me with?
I've developed a very simple 2 page JSF application using Workshop v3.2.1
which just allows you to move from the first to the second pages using a
commandLinks action to trigger a JSF navigation. This has all the "common"
JARs as per the shale-framework-1.0.4.zip and works fine. However when I
added in the shale-*-1.0.4.jar's, spring-*1.2.8.jar's and
tiles-core-2.0-468346-SNAPSHOT.jar and make some config file changes to
introduce Tiles behaviour I start to get problems.
To my faces-config.xml I added
<view-handler>org.apache.shale.tiles.TilesViewHandler</view-handler>
To my web.xml file I added a context parameter pointing to my new tiles.xml
file
<context-param>
<param-name>tiles-definitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
and added an additional servlet
<servlet>
<servlet-name>Tiles Servlet</servlet-name>
<servlet-class>org.apache.tiles.servlet.TilesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
the existing (faces) servlet had the load-on-startup value changed to 2
(from 1) at this point.
I created a tiles.xml file (within the WEB-INF folder) that just defines a
header, menu, content format for these same 2 pages (with the header being
made up of 3 sub-parts a banner, breadcrumb trail and heading).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
<!--
These are the general tile layouts that will be used by every page
-->
<definition name="header" path="/tiles/header.jsp">
<put name="banner" value="/pages/exampleBanner.jsp" />
<put name="breadcrumb" value="/pages/exampleBreadcrumb.jsp" />
<put name="headerTitle" value="/pages/exampleHeader.jsp" />
</definition>
<definition name="menu" path="/tiles/menu.jsp">
<put name="menuDetail" value="/pages/exampleMenu.jsp" />
</definition>
<!--
These are the definitions for each page
-->
<definition name="page1" path="/tiles/headerMenuContent.jsp">
<put name="header" value="header"/>
<put name="menu" value="menu"/>
<put name="content" value="page1Content"/>
</definition>
<definition name="page1Content" path="/tiles/content.jsp" >
<put name="contentContent" value="/pages/standardPage.jsp" />
</definition>
<definition name="page2" path="/tiles/headerMenuContent.jsp">
<put name="header" value="header"/>
<put name="menu" value="menu"/>
<put name="content" value="page2Content"/>
</definition>
<definition name="page2Content" path="/tiles/content.jsp" >
<put name="contentContent" value="/pages/standardPage2.jsp" />
</definition>
</tiles-definitions>
I also added in the necessary menu, header, content and headerMenuContent
JSPs into the tiles folder (at the same level as the pages folder) and the
example*** JSPs into the pages folder.
The application builds within Workshop OK but when I try and run it (Tomcat
v5.5) I get the following output in the console...
INFO: Initializing TilesServlet
24-Jan-2007 16:05:29 org.apache.tiles.servlet.TilesServlet readFactoryConfig
INFO: CONFIG FILES WERE NOT DEFINED IN WEB.XML, LOOKING FOR
/WEB-INF/tiles.xml
24-Jan-2007 16:05:29 org.apache.tiles.servlet.TilesServlet
initDefinitionsFactory
INFO: initializing definitions factory...
org.apache.tiles.DefinitionsFactoryException: I/O Error reading definitions.
at
org.apache.tiles.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:161)
at
org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(UrlDefinitionsFactory.java:253)
at
org.apache.tiles.TilesUtilImpl.createDefinitionsFactory(TilesUtilImpl.java:190)
at org.apache.tiles.TilesUtil.createDefinitionsFactory(TilesUtil.java:165)
at
org.apache.tiles.servlet.TilesServlet.initDefinitionsFactory(TilesServlet.java:234)
at org.apache.tiles.servlet.TilesServlet.init(TilesServlet.java:174)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
24-Jan-2007 16:05:45 org.apache.tiles.servlet.TilesServlet
saveExceptionMessage
WARNING: Caught exception when initializing definitions factory
I assume this is complaining about the format of my tiles.xml file but I
don't know how to correct it. Sorry to be posting such basic questions but
I am very new to this area.
Regards,
Dave
--
View this message in context: http://www.nabble.com/Integrating-JSF-and-Shale-Tiles-tf3083236.html#a8567971
Sent from the Shale - User mailing list archive at Nabble.com.
Re: Integrating JSF and Shale Tiles
Posted by Greg Reddin <gr...@gmail.com>.
On 1/24/07, Craig McClanahan <cr...@apache.org> wrote:
>
> > INFO: Initializing TilesServlet
> > 24-Jan-2007 16:05:29
> org.apache.tiles.servlet.TilesServletreadFactoryConfig
> > INFO: CONFIG FILES WERE NOT DEFINED IN WEB.XML, LOOKING FOR
> > /WEB-INF/tiles.xml
>
>
> This message implies that your context init parameter is not being
> recognized. If I am reading the Tiles code correctly, the parameter name
> should now be "org.apache.tiles.DEFINITIONS_CONFIG" although
> "definitions-config" is still recognized for backwards compatibility.
Yes try "definitions-config" and see if that works. You can also check the
example web.xml found here:
https://svn.apache.org/repos/asf/tiles/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
24-Jan-2007 16:05:29 org.apache.tiles.servlet.TilesServlet
> > initDefinitionsFactory
> > INFO: initializing definitions factory...
> > org.apache.tiles.DefinitionsFactoryException: I/O Error reading
> > definitions.
> > at
>
>
> The fact that this says I/O error instead of parsing error implies that
> the
> problem is not finding the file at all (rather than some problem with the
> XML syntax).
I've seen this error before when Tiles could not load the file for one
reason or another. As Craig said I don't think it's a problem with the XML,
it appears to be a problem loading the file itself.
Greg
Re: Integrating JSF and Shale Tiles
Posted by Craig McClanahan <cr...@apache.org>.
A couple of intermixed comments ... I'm hoping Greg and others more familiar
with Tiles than I am might be able to help too.
On 1/24/07, dave@nr <da...@northernrock.co.uk> wrote:
>
>
> I've tried to use the shale-framework-1.0.4.zip file and have hit a
> problem
> that I was wondering if anyone could help me with?
>
> I've developed a very simple 2 page JSF application using Workshop v3.2.1
> which just allows you to move from the first to the second pages using a
> commandLinks action to trigger a JSF navigation. This has all the
> "common"
> JARs as per the shale-framework-1.0.4.zip and works fine. However when I
> added in the shale-*-1.0.4.jar's, spring-*1.2.8.jar's and
> tiles-core-2.0-468346-SNAPSHOT.jar and make some config file changes to
> introduce Tiles behaviour I start to get problems.
It might be a little easier to debug things like this if you only add one
layer of stuff at a time :-).
To my faces-config.xml I added
> <view-handler>org.apache.shale.tiles.TilesViewHandler</view-handler>
You do not need to do this ... it is already done inside the
shale-tiles-xxx.jar file.
To my web.xml file I added a context parameter pointing to my new tiles.xml
> file
> <context-param>
> <param-name>tiles-definitions</param-name>
> <param-value>/WEB-INF/tiles.xml</param-value>
> </context-param>
> and added an additional servlet
> <servlet>
> <servlet-name>Tiles Servlet</servlet-name>
> <servlet-class>org.apache.tiles.servlet.TilesServlet
> </servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> the existing (faces) servlet had the load-on-startup value changed to 2
> (from 1) at this point.
>
> I created a tiles.xml file (within the WEB-INF folder) that just defines a
> header, menu, content format for these same 2 pages (with the header being
> made up of 3 sub-parts a banner, breadcrumb trail and heading).
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE tiles-definitions PUBLIC
> "-//Apache Software Foundation//DTD Tiles Configuration//EN"
> "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
>
> <tiles-definitions>
>
> <!--
> These are the general tile layouts that will be used by every page
> -->
> <definition name="header" path="/tiles/header.jsp">
> <put name="banner" value="/pages/exampleBanner.jsp" />
> <put name="breadcrumb"
> value="/pages/exampleBreadcrumb.jsp" />
> <put name="headerTitle" value="/pages/exampleHeader.jsp"
> />
> </definition>
>
> <definition name="menu" path="/tiles/menu.jsp">
> <put name="menuDetail" value="/pages/exampleMenu.jsp" />
> </definition>
>
> <!--
> These are the definitions for each page
> -->
> <definition name="page1" path="/tiles/headerMenuContent.jsp">
> <put name="header" value="header"/>
> <put name="menu" value="menu"/>
> <put name="content" value="page1Content"/>
> </definition>
> <definition name="page1Content" path="/tiles/content.jsp" >
> <put name="contentContent" value="/pages/standardPage.jsp"
> />
> </definition>
>
> <definition name="page2" path="/tiles/headerMenuContent.jsp">
> <put name="header" value="header"/>
> <put name="menu" value="menu"/>
> <put name="content" value="page2Content"/>
> </definition>
> <definition name="page2Content" path="/tiles/content.jsp" >
> <put name="contentContent"
> value="/pages/standardPage2.jsp" />
> </definition>
>
> </tiles-definitions>
>
> I also added in the necessary menu, header, content and headerMenuContent
> JSPs into the tiles folder (at the same level as the pages folder) and the
> example*** JSPs into the pages folder.
>
> The application builds within Workshop OK but when I try and run it
> (Tomcat
> v5.5) I get the following output in the console...
>
> INFO: Initializing TilesServlet
> 24-Jan-2007 16:05:29 org.apache.tiles.servlet.TilesServletreadFactoryConfig
> INFO: CONFIG FILES WERE NOT DEFINED IN WEB.XML, LOOKING FOR
> /WEB-INF/tiles.xml
This message implies that your context init parameter is not being
recognized. If I am reading the Tiles code correctly, the parameter name
should now be "org.apache.tiles.DEFINITIONS_CONFIG" although
"definitions-config" is still recognized for backwards compatibility.
24-Jan-2007 16:05:29 org.apache.tiles.servlet.TilesServlet
> initDefinitionsFactory
> INFO: initializing definitions factory...
> org.apache.tiles.DefinitionsFactoryException: I/O Error reading
> definitions.
> at
The fact that this says I/O error instead of parsing error implies that the
problem is not finding the file at all (rather than some problem with the
XML syntax).
Craig
org.apache.tiles.digester.DigesterDefinitionsReader.read(
> DigesterDefinitionsReader.java:161)
> at
> org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(
> UrlDefinitionsFactory.java:253)
> at
> org.apache.tiles.TilesUtilImpl.createDefinitionsFactory(TilesUtilImpl.java
> :190)
> at org.apache.tiles.TilesUtil.createDefinitionsFactory(
> TilesUtil.java:165)
> at
> org.apache.tiles.servlet.TilesServlet.initDefinitionsFactory(
> TilesServlet.java:234)
> at org.apache.tiles.servlet.TilesServlet.init(TilesServlet.java
> :174)
> at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java
> :1091)
> at org.apache.catalina.core.StandardWrapper.load(
> StandardWrapper.java:925)
> at
> org.apache.catalina.core.StandardContext.loadOnStartup(
> StandardContext.java:3857)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
> :1012)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java
> :718)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
> :1012)
> at org.apache.catalina.core.StandardEngine.start(
> StandardEngine.java:442)
> at org.apache.catalina.core.StandardService.start(
> StandardService.java:450)
> at org.apache.catalina.core.StandardServer.start(
> StandardServer.java:683)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
> 24-Jan-2007 16:05:45 org.apache.tiles.servlet.TilesServlet
> saveExceptionMessage
> WARNING: Caught exception when initializing definitions factory
>
> I assume this is complaining about the format of my tiles.xml file but I
> don't know how to correct it. Sorry to be posting such basic questions
> but
> I am very new to this area.
>
> Regards,
> Dave
> --
> View this message in context:
> http://www.nabble.com/Integrating-JSF-and-Shale-Tiles-tf3083236.html#a8567971
> Sent from the Shale - User mailing list archive at Nabble.com.
>
>