You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Venu Gopalan <ve...@yahoo.com.INVALID> on 2017/03/16 15:11:56 UTC

Struts 1 / Tile 2 integration issue

My ultimate goal is to migrate an application to spring 4.1.4, Hibernate 4.3. But this was resulting to migrate Tiles 1.x to Tiles 2.x. But this intern was creating issues with Struts 1. With the help of Tiles user community, I was able to get the struts-tiles2-1.4.0-SNAPSHOT.jar

library and I'm trying to migrate a small sample application from Strits 1/Tiles 1 to Struts 1/Tiles 2. After making changes according to the suggestions in https://feima2011.wordpress.com/2011/04/27/struts-1-and-tiles-2-integration/ , I'm getting the following error while running the application in the browser.
| 

Error 500--Internal Server Error
 |


| java.lang.NullPointerException
	at org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:42)
	at org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:187)
	at org.apache.tiles.template.InsertAttributeModel.start(InsertAttributeModel.java:107)
	at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)
	at jsp_servlet.__index._jspService(__index.java:93)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
	at java.security.AccessController.doPrivileged(Native Method)
	at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
	at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
	at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
	at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
	at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3729)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3695)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2285)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2184)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1459)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)In the tiles-defs.xml, I made the changes as below: (PUT changed to put-attribute) (definition path TO definition template) etc    <definition name="baseLayout" template="/baseLayout.jsp">
        <put-attribute name="title"  value="Tiles Example" />
        <put-attribute name="header" value="/header.jsp" />
        <put-attribute name="menu"   value="/menu.jsp" />
        <put-attribute name="body"   value="/body.jsp" />
        <put-attribute name="footer" value="/footer.jsp" />        
    </definition>
    <definition name="friends" extends="baseLayout">
        <put-attribute name="title" value="Friends" />
        <put-attribute name="body" value="/friends.jsp" />
    </definition>
    <definition name="office" extends="baseLayout">
        <put-attribute name="title" value="The Office" />
        <put-attribute name="body" value="/office.jsp" />
    </definition>

In Jsp's I changed the tag  <tiles:insert name="header" ignore="true" /> TO <tiles:insertAttribute name="header" ignore="true" />
Also in struts-config file,<controller processorClass="org.apache.struts.tiles2.TilesRequestProcessor"/>AND<plug-in className="org.apache.struts.tiles2.TilesPlugin" >

I do have the following jar in my WEB-INF/lib and classpathstruts-core-1.4.0-SNAPSHOT.jar
struts-tiles2-1.4.0-SNAPSHOT.jar
struts-extras-1.4.0-SNAPSHOT.jar
struts-scripting-1.4.0-SNAPSHOT.jar
struts-taglib-1.4.0-SNAPSHOT.jar
struts-tiles-1.4.0-SNAPSHOT.jar
tiles-api-2.2.1.jar
tiles-jsp-2.2.1.jar
tiles-servlet-2.2.1.jar
tiles-template-2.2.0.jar
log4j-1.2.16.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
jakarta-oro.jar

I have removed the struts.jar earlier, but with and without struts.jar, I'm getting the same error.Can any friends be a help on this issue? I am unable to attach the ZIP of the application.


Thank YouVenu |


Re: Struts 1 / Tile 2 integration issue

Posted by Venu Gopalan <ve...@yahoo.com.INVALID>.
Actually the error happens in index jsp
<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%--<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>--%><%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertAttribute name="/baseLayout.jsp" flush="true">    <tiles:putAttribute name="title" value="Tiles Example"/>    <tiles:putAttribute name="header" value="/header.jsp" />    <tiles:putAttribute name="menu" value="/menu.jsp" />    <tiles:putAttribute name="body" value="/body.jsp" />    <tiles:putAttribute name="footer" value="/footer.jsp" /></tiles:insertAttribute>
Somehow the insertAttribute tag is causing the issue.
Pls help.
Thanks Venu 

    On Thursday, 16 March 2017 11:24 AM, Venu Gopalan <ve...@yahoo.com.INVALID> wrote:
 

 My ultimate goal is to migrate an application to spring 4.1.4, Hibernate 4.3. But this was resulting to migrate Tiles 1.x to Tiles 2.x. But this intern was creating issues with Struts 1. With the help of Tiles user community, I was able to get the struts-tiles2-1.4.0-SNAPSHOT.jar

library and I'm trying to migrate a small sample application from Strits 1/Tiles 1 to Struts 1/Tiles 2. After making changes according to the suggestions in https://feima2011.wordpress.com/2011/04/27/struts-1-and-tiles-2-integration/ , I'm getting the following error while running the application in the browser.
| 

Error 500--Internal Server Error
 |


| java.lang.NullPointerException
	at org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:42)
	at org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:187)
	at org.apache.tiles.template.InsertAttributeModel.start(InsertAttributeModel.java:107)
	at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)
	at jsp_servlet.__index._jspService(__index.java:93)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
	at java.security.AccessController.doPrivileged(Native Method)
	at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
	at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
	at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
	at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
	at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3729)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3695)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2285)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2184)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1459)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)In the tiles-defs.xml, I made the changes as below: (PUT changed to put-attribute) (definition path TO definition template) etc    <definition name="baseLayout" template="/baseLayout.jsp">
        <put-attribute name="title"  value="Tiles Example" />
        <put-attribute name="header" value="/header.jsp" />
        <put-attribute name="menu"   value="/menu.jsp" />
        <put-attribute name="body"   value="/body.jsp" />
        <put-attribute name="footer" value="/footer.jsp" />        
    </definition>
    <definition name="friends" extends="baseLayout">
        <put-attribute name="title" value="Friends" />
        <put-attribute name="body" value="/friends.jsp" />
    </definition>
    <definition name="office" extends="baseLayout">
        <put-attribute name="title" value="The Office" />
        <put-attribute name="body" value="/office.jsp" />
    </definition>

In Jsp's I changed the tag  <tiles:insert name="header" ignore="true" /> TO <tiles:insertAttribute name="header" ignore="true" />
Also in struts-config file,<controller processorClass="org.apache.struts.tiles2.TilesRequestProcessor"/>AND<plug-in className="org.apache.struts.tiles2.TilesPlugin" >

I do have the following jar in my WEB-INF/lib and classpathstruts-core-1.4.0-SNAPSHOT.jar
struts-tiles2-1.4.0-SNAPSHOT.jar
struts-extras-1.4.0-SNAPSHOT.jar
struts-scripting-1.4.0-SNAPSHOT.jar
struts-taglib-1.4.0-SNAPSHOT.jar
struts-tiles-1.4.0-SNAPSHOT.jar
tiles-api-2.2.1.jar
tiles-jsp-2.2.1.jar
tiles-servlet-2.2.1.jar
tiles-template-2.2.0.jar
log4j-1.2.16.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
jakarta-oro.jar

I have removed the struts.jar earlier, but with and without struts.jar, I'm getting the same error.Can any friends be a help on this issue? I am unable to attach the ZIP of the application.


Thank YouVenu |