Barry Sheward created TILES-578:
-----------------------------------

             Summary: org.apache.tiles.template.NoSuchAttributeException occurs 
when the attribute exists.
                 Key: TILES-578
                 URL: https://issues.apache.org/jira/browse/TILES-578
             Project: Tiles
          Issue Type: Bug
          Components: tiles-core
    Affects Versions: 3.0.4
         Environment: Mac OS X Mavericks, RedHat WildFly 8.
            Reporter: Barry Sheward


I get an exception "{{org.apache.tiles.template.NoSuchAttributeException: 
Attribute 'filtered_content' not found.}}" despite the fact that the attribute 
is defined.

I have 3 levels of tiles nested using extends, which shows "{{title_section}}" 
is defined:

{code:xml|title=tiles.xml|borderStyle=solid}
    <definition name="tiles.base" template="/new_gui/layout/legacy.jsp" >
    </definition>

    <definition name="tiles.base_filtered" extends="tiles.base" >
        <put-attribute name="body_content" 
value="/new_gui/layout/base_filtered.jsp" />
    </definition>

    <definition name="test.filtered" extends="tiles.base_filtered" >
        <put-attribute name="title" value="Filtered Test" />
        <put-attribute name="filtered_content" value="Hello, World!" />
        <!-- put-attribute name="content" value="/new_gui/tiles/test/test.jsp" 
/ -->
    </definition>
{code}

When I access /test.filtered.tiles, the stack trace shows the JSP files are 
resolving correctly:

{noformat}
23:32:01,911 ERROR ServletInitialHandler:249] (default task-15) UT005023: 
Exception handling request to /new_gui/layout/legacy.jsp: 
org.apache.tiles.request.render.CannotRenderException: ServletException 
including path '/new_gui/layout/legacy.jsp'.
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399) 
[tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) 
[tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.TilesContainerWrapper.render(TilesContainerWrapper.java:103) 
[tiles-api-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContainer.java:126)
 [tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.web.util.TilesDispatchServlet.doGet(TilesDispatchServlet.java:105)
 [tiles-servlet-3.0.4.jar:3.0.4]
    ....
Caused by: java.io.IOException: ServletException including path 
'/new_gui/layout/legacy.jsp'.
        at 
org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
    ....
Caused by: java.io.IOException: JSPException including path 
'/new_gui/layout/base_filtered.jsp'.
        at 
org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
    ....
Caused by: org.apache.tiles.template.NoSuchAttributeException: Attribute 
'filtered_content' not found.
        at 
org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:50)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:165)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:121)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
 [tiles-jsp-3.0.4.jar:3.0.4]
        at 
org.apache.jsp.new_005fgui.layout.base_005fwide_jsp._jspx_meth_tiles_005finsertAttribute_005f0(base_005fwide_jsp.java:229)
        at 
org.apache.jsp.new_005fgui.layout.base_005fwide_jsp._jspService(base_005fwide_jsp.java:179)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:366) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:229)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchToServlet(ServletInitialHandler.java:178)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.spec.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:940) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:639) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:633) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123) 
[tiles-request-jsp-1.0.4.jar:1.0.4]
        ... 64 more
{noformat}

The contents of base_filtered.jsp are:

{code}title=base_filtered.jsp|borderStyle=sold}
<div class="filtered_content" >

    <div class="filtered_menus">
        <div class="ui-corner-top filtered_menu_item" onclick="location.href = 
'summary.jsp?menu=systems';"><p title="Summary">Example</p></div>
    </div>

    <div class="filtered_views ui-corner-all" >
        <tiles:insertAttribute name="filtered_content" />
        base_filtered.jsp
        <!-- tiles:insertAttribute name="title" / -->
    </div>
    
</div> <!-- end filtered content -->
{code}

Interestingly, if I comment out the {{<tiles:insertAttribute 
name="filtered_content" />}}, not only does the page render, but the title, 
which is inserted via the legacy.jsp page, is rendered correctly, as "Filtered 
Test".

However, if I insert {{<tiles:insertAttribute name="filtered_content" />}} into 
legacy.jsp, it also fails, and the stacktrace shows:

{noformat}
00:01:51,207 ERROR ServletInitialHandler:249] (default task-7) UT005023: 
Exception handling request to /new_gui/layout/legacy.jsp: 
org.apache.tiles.request.render.CannotRenderException: ServletException 
including path '/new_gui/layout/legacy.jsp'.
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399) 
[tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) 
[tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.TilesContainerWrapper.render(TilesContainerWrapper.java:103) 
[tiles-api-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContainer.java:126)
 [tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.web.util.TilesDispatchServlet.doGet(TilesDispatchServlet.java:105)
 [tiles-servlet-3.0.4.jar:3.0.4]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) 
[undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) 
[undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[rt.jar:1.8.0]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[rt.jar:1.8.0]
        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
Caused by: java.io.IOException: ServletException including path 
'/new_gui/layout/legacy.jsp'.
        at 
org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
        at 
org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:267)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
        at 
org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
        at 
org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
 [tiles-request-api-1.0.4.jar:1.0.4]
        at 
org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
 [tiles-request-api-1.0.4.jar:1.0.4]
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) 
[tiles-core-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397) 
[tiles-core-3.0.4.jar:3.0.4]
        ... 33 more
Caused by: org.apache.tiles.template.NoSuchAttributeException: Attribute 
'filtered_content' not found.
        at 
org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:50)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:165)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:121)
 [tiles-template-3.0.4.jar:3.0.4]
        at 
org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
 [tiles-jsp-3.0.4.jar:3.0.4]
        at 
org.apache.jsp.new_005fgui.layout.legacy_jsp._jspx_meth_tiles_005finsertAttribute_005f1(legacy_jsp.java:433)
        at 
org.apache.jsp.new_005fgui.layout.legacy_jsp._jspService(legacy_jsp.java:193)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:366) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) 
[jastow-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
[jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
 [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:229)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:172)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:158)
 [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at 
org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
 [tiles-request-servlet-1.0.4.jar:1.0.4]
        ... 38 more
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to