tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abhishek Vishwakarma <abhishek.vishwaka...@gmail.com>
Subject Issue with Nested Tiles while integrating with Spring 3.0
Date Sun, 23 Dec 2012 12:40:32 GMT
Hi,



I am trying to create one sample applicaiton on nested tiles with spring
3.0. (Attached source code of sample application at the end)



When I am running the application below is the error [12/22/12 18:02:20:968
IST] 00000057 ServletWrappe E   SRVE0068E: Uncaught exception thrown in one
of the service methods of the servlet: /WEB-INF/jsp/layout.jsp. Exception
thrown : java.lang.ClassCastException: java.lang.String incompatible with
org.apache.tiles.Attribute

            at
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)

            at
com.ibm._jsp._layout._jspx_meth_tiles_insertAttribute_3(_layout.java:168)

            at com.ibm._jsp._layout._jspx_meth_c_forEach_0(_layout.java:188)

            at com.ibm._jsp._layout._jspService(_layout.java:101)

            at
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)

            at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

            at
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)

            at
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226)

            at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)

            at
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)

            at
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)

            at
org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)

            at
org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)

            at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)

            at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)

            at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)

            at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)

            at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)

            at
org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:124)

            at
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)

            at
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)

            at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)

            at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)

            at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

            at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)

            at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

            at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)

            at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:518)

            at com.ibm._jsp._index._jspService(_index.java:64)

            at
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)

            at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

            at
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)

            at
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226)

            at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)

            at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)

            at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)

            at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)

            at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)

            at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

            at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

            at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

            at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

            at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

            at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

            at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)

            at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)

            at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)

            at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)



[12/22/12 18:02:20:968 IST] 00000057 LocalTranCoor E   WLTC0017E: Resources
rolled back due to setRollbackOnly() being called.

[12/22/12 18:02:20:968 IST] 00000057 ServletWrappe E   SRVE0068E: Uncaught
exception thrown in one of the service methods of the servlet: spring.
Exception thrown : org.springframework.web.util.NestedServletException:
Request processing failed; nested exception is
java.lang.ClassCastException: java.lang.String incompatible with
org.apache.tiles.Attribute

            at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)

            at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)

            at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

            at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)

            at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:518)

            at com.ibm._jsp._index._jspService(_index.java:64)

            at
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)

            at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570)

            at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

            at
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)

            at
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226)

            at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)

            at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)

            at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)

            at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)

            at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)

            at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)

            at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

            at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

            at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

            at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

            at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

            at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

            at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)

            at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)

            at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)

            at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

Caused by: java.lang.ClassCastException: java.lang.String incompatible with
org.apache.tiles.Attribute

            at
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)

            at
com.ibm._jsp._layout._jspx_meth_tiles_insertAttribute_3(_layout.java:168)
            at com.ibm._jsp._layout._jspx_meth_c_forEach_0(_layout.java:188)


*Source code goes as below*



spring xml file

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

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xmlns:p="http://www.springframework.org/schema/p"

            xmlns:context="http://www.springframework.org/schema/context"

            xsi:schemaLocation="http://www.springframework.org/schema/beans


http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                        http://www.springframework.org/schema/context


http://www.springframework.org/schema/context/spring-context-3.0.xsd">

             <context:component-scan
base-package="net.viralpatel.spring3.controller"
/>

             <bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">

                        <property name="viewClass">

                                    <value>


org.springframework.web.servlet.view.tiles2.TilesView

                                    </value>

                        </property>

            </bean>

            <bean id="tilesConfigurer"


class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">

                        <property name="definitions">

                                    <list>


<value>/WEB-INF/tiles.xml</value>

                                    </list>

                        </property>

            </bean>

</beans>



 tiles.xml

----------

<?xml version=*"1.0"* encoding=*"UTF-8"* ?>

<!DOCTYPE tiles-definitions PUBLIC

       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"

       "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

      <definition name=*"base.definition"* template=*
"/WEB-INF/jsp/layout.jsp"*>

            <put-attribute name=*"title"* value=*""* />

            <put-attribute name=*"header"* value=*"/WEB-INF/jsp/header.jsp"*
/>

            <put-attribute name=*"menu"* value=*"/WEB-INF/jsp/menu.jsp"* />

            <put-attribute name=*"body"* value=*""* />

            <put-attribute name=*"footer"* value=*"/WEB-INF/jsp/footer.jsp"*
/>

      </definition>



      <definition name=*"contact"* extends=*"base.definition"*>

            <put-attribute name=*"title"* value=*"Contact Manager"* />

            <put-list-attribute name=*"body"*>

                  <add-attribute value=*"/WEB-INF/jsp/contact.jsp"*></
add-attribute>

            </put-list-attribute>

      </definition>



</tiles-definitions>



   layout.jsp

----------

<%@ taglib uri=*"http://tiles.apache.org/tags-tiles"* prefix=*"tiles"*%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri=*"http://java.sun.com/jstl/core_rt"* prefix=*"c"* %>



<%@page import=*"java.util.ArrayList"*%><html>

<head>

<meta http-equiv=*"Content-Type"* content=*"text/html; charset=UTF-8"*>

<title><tiles:insertAttribute name=*"title"* ignore=*"true"* /></title>

</head>

<body>

<tiles:useAttribute  classname=*"java.util.List"* id=*"bodyList"* name=*
"body"*/>



<table border=*"1"* cellpadding=*"2"* cellspacing=*"2"* align=*"center"*>

      <tr>

            <td height=*"30"* colspan=*"2"*><tiles:insertAttribute name=*
"header"* />

            </td>

      </tr>

      <tr>

            <td height=*"250"*><tiles:insertAttribute name=*"menu"* /></td>

            <c:forEach var=*"bodyItems"* items="${bodyList}" >



                  <td width=*"350"*><tiles:insertAttribute  value="
${bodyItems}"></tiles:insertAttribute> </td>

            </c:forEach>

            </tr>

      <tr>

            <td height=*"30"* colspan=*"2"*><tiles:insertAttribute name=*
"footer"* />

            </td>

      </tr>

</table>

</body>

</html>



When I say *"*><tiles:insertAttribute  value="${bodyItems}"></
tiles:insertAttribute> </td>  here it is throwing exception and I am using
below jars

tiles-api-2.2.2.jar

tiles-core-2.2.2.jar

tiles-jsp-2.2.2.jar

tiles-servlet-2.2.2.jar

tiles-template-2.2.2.jar

standard-1.0.6.jar along with spring 3.0 version jars



Please advise on above.



Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message