Struts 1 / Tile 2 integration issue

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Struts 1 / Tile 2 integration issue

Venu Gopalan
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 classpath
struts-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 You
Venu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Venu Gopalan
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 <[hidden email]> 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 |



   
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Venu Gopalan
In reply to this post by Venu Gopalan
Below is the server console output. Pls let me know if you can figure out the issue here
[2017-03-16T14:44:17.986-04:00] [AdminServer] [WARNING] [] [org.apache.struts.util.PropertyMessageResources] [tid: [STANDBY].ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 2d77fd9e20723ca4:-665230d4:15ad2802d69:-8000-0000000000000369,0] [APP: sampleTiles2]   Resource org/apache/struts/action/ActionResources_en_US.properties Not Found.[2017-03-16T14:44:17.988-04:00] [AdminServer] [WARNING] [] [org.apache.struts.util.PropertyMessageResources] [tid: [STANDBY].ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 2d77fd9e20723ca4:-665230d4:15ad2802d69:-8000-0000000000000369,0] [APP: sampleTiles2]   Resource org/apache/struts/action/ActionResources_en.properties Not Found.[2017-03-16T14:44:39.477-04:00] [AdminServer] [NOTIFICATION] [DFW-40101] [oracle.dfw.incident] [tid: [STANDBY].ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <WLS Kernel>] [ecid: 2d77fd9e20723ca4:-665230d4:15ad2802d69:-8000-0000000000000373,0] An incident has been signalled with the incident facts: [problemKey=DFW-99998 [java.lang.NullPointerException][oracle.security.jps.ee.http.JpsAbsFilter$1.run][sampleTiles2] incidentSource=SYSTEM incidentTime=Thu Mar 16 14:44:39 EDT 2017 errorMessage=DFW-99998 executionContextId=2d77fd9e20723ca4:-665230d4:15ad2802d69:-8000-0000000000000370][2017-03-16T14:44:40.087-04:00] [AdminServer] [INCIDENT_ERROR] [DFW-40104] [oracle.dfw.incident] [tid: [STANDBY].ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <WLS Kernel>] [ecid: 2d77fd9e20723ca4:-665230d4:15ad2802d69:-8000-0000000000000373,0] [errid: 30] [detailLoc: c:\oracle\middleware\user_projects\domains\cmsvenu1\servers\adminserver\adr\diag\ofm\cmsvenu1\adminserver\incident\incdir_30] [probKey: DFW-99998 [java.lang.NullPointerException\r][oracle.security.jps.ee.http.JpsAbsFilter$1.run][sampleTiles2]] incident 30 created with problem key "DFW-99998 [java.lang.NullPointerException][oracle.security.jps.ee.http.JpsAbsFilter$1.run][sampleTiles2]"
Thanks Venu

    On Thursday, 16 March 2017 3:41 PM, Venu Gopalan <[hidden email]> wrote:
 

 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 <[hidden email]> 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 |



 

   
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Torsten Krah
What about a debugger? Did you had a look at the failing code piece in
the:

DefaultAttributeResolver.java on line 42

Which variable is null, what the origin of the var? Who should set it -
if it is set somewhere why its lost ... more specific question are
needed than some error outputs with traces to which no one got an sample
app.

Its so dated code - you need to supply more information here so we may
have a chance to help you.

Cheers

Torsten

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Venu Gopalan
Thank you for the reply Torsten. Sorry for not putting the line where it fails. Below is the code failing in DefaultAttributeResolver.java at line#42. (highlighted). This class is part of tiles-template-2.2.1.jar. Ultimately the container variable is null which is org.apache.tiles.TilesContainer. TilesContainer is part of tiles-api-2.2.1.jar. I have both jars in the classpath and WEB-INF\lib. No idea any other set up is needed.
package org.apache.tiles.template;
import org.apache.tiles.Attribute;import org.apache.tiles.AttributeContext;import org.apache.tiles.Expression;import org.apache.tiles.TilesContainer;
/** * The default implementation of AttributeResolver. * * @version $Rev: 788032 $ $Date: 2009-06-24 16:08:32 +0200(mer, 24 giu 2009) $ * @since 2.2.0 */public class DefaultAttributeResolver implements AttributeResolver {
    /** {@inheritDoc} */    public Attribute computeAttribute(TilesContainer container, Attribute attribute,            String name, String role, boolean ignore,            Object defaultValue, String defaultValueRole, String defaultValueType, Object... requestItems) {        if (attribute == null) {            AttributeContext evaluatingContext = container                    .getAttributeContext(requestItems);            attribute = evaluatingContext.getAttribute(name);            if (attribute == null) {                attribute = computeDefaultAttribute(defaultValue,                        defaultValueRole, defaultValueType);                if (attribute == null && !ignore) {                    throw new NoSuchAttributeException("Attribute '" + name                            + "' not found.");                }            }        }        if (attribute != null && role != null && !"".equals(role.trim())) {            attribute = new Attribute(attribute);            attribute.setRole(role);        }        return attribute;    }
    private Attribute computeDefaultAttribute(Object defaultValue,            String defaultValueRole, String defaultValueType) {        Attribute attribute = null;        if (defaultValue != null) {            if (defaultValue instanceof Attribute) {                attribute = (Attribute) defaultValue;            } else if (defaultValue instanceof String) {                attribute = new Attribute(defaultValue, (Expression) null,                        defaultValueRole, defaultValueType);            }        }        return attribute;    }}
Thank you Venu

    On Friday, 17 March 2017 10:00 AM, Torsten Krah <[hidden email]> wrote:
 

 What about a debugger? Did you had a look at the failing code piece in
the:

DefaultAttributeResolver.java on line 42

Which variable is null, what the origin of the var? Who should set it -
if it is set somewhere why its lost ... more specific question are
needed than some error outputs with traces to which no one got an sample
app.

Its so dated code - you need to supply more information here so we may
have a chance to help you.

Cheers

Torsten



   
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Torsten Krah
I know the line where its failing - were in the stacktrace.

The question is why the container got null.

If you have a look at the other classes in the trace which are called
before it should never reach the stack that deep but fail before with an
error like there is no container.
To me this look like you're overall setup is missing to correctly setup
the TilesContainer with the ServletContext.

Take a debugger and have a look why it would not fail on the first
invocations of those tiles tags which checks for a non null container
and who might remove it.

kind regards


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Venu Gopalan
Thank you... I was not getting the servlet context. I added the below line in the web.xml and the null pointer is gone.    <servlet>   <servlet-name>title</servlet-name>   <servlet-class>org.apache.tiles.web.startup.TilesServlet </servlet-class>   <load-on-startup>1</load-on-startup>      </servlet>
But Now am getting :org.apache.tiles.template.NoSuchAttributeException: Attribute '/baseLayout.jsp' not found.
        at org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:49)
below is the tiles-defs.xml    <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>
Below is the index.jsp<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>

Still debugging.
 

    On Friday, 17 March 2017 11:25 AM, Torsten Krah <[hidden email]> wrote:
 

 I know the line where its failing - were in the stacktrace.

The question is why the container got null.

If you have a look at the other classes in the trace which are called
before it should never reach the stack that deep but fail before with an
error like there is no container.
To me this look like you're overall setup is missing to correctly setup
the TilesContainer with the ServletContext.

Take a debugger and have a look why it would not fail on the first
invocations of those tiles tags which checks for a non null container
and who might remove it.

kind regards




   
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Torsten Krah
I thought you were upgrading to Spring 4.3.x?
You should imho use the TilesConfigurer from Spring 4.3:

https://docs.spring.io/spring/docs/4.3.x/spring-framework-reference/htmlsingle/#view-tiles

http://docs.spring.io/spring-framework/docs/4.3.x/javadoc-api/org/springframework/web/servlet/view/tiles2/TilesConfigurer.html

kind regards

Torsten

Am Freitag, den 17.03.2017, 16:07 +0000 schrieb Venu Gopalan:
>     <servlet>
>   <servlet-name>title</servlet-name>
>   <servlet-class>org.apache.tiles.web.startup.TilesServlet
> </servlet-class>
>   <load-on-startup>1</load-on-startup>
>
>      </servlet>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Torsten Krah
In reply to this post by Venu Gopalan
This seems kind of strange:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/insertAttribute.html

/baseLayout.jsp is not a name of an attribute but the template name of
the definition, looks suspicious to me.

Maybe you mean:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/insertTemplate.html

If you look here:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/tld-summary.html

This looks like the one you're looking for:

<tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
                   <tiles:putAttribute name="title" value="My first
page" />
                   <tiles:putAttribute name="header"
value="/common/header.jsp" />
                   <tiles:putAttribute name="footer"
value="/common/footer.jsp" />
                   <tiles:putAttribute name="menu"
value="/basic/menu.jsp" />
                   <tiles:putAttribute name="body"
value="/basic/helloBody.jsp" />
                </tiles:insertTemplate>



Could you double check that.

kind regards

Torsten

Am Freitag, den 17.03.2017, 16:07 +0000 schrieb Venu Gopalan:
> <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>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts 1 / Tile 2 integration issue

Venu Gopalan
When I changed <tiles:insertAttribute name="/baseLayout.jsp" flush="true">        <tiles:putAttribute name="title" value="Tiles Example"/>  TO         <tiles:insertTemplate template="/baseLayout.jsp" flush="true">            <tiles:putAttribute name="title" value="Tiles Example"/>
Finally the page loaded. Thank you.
Actually I need to upgrade a huge and very old govt application to spring 4.1.x and Hibernate 4 which intern forced to change Tiles 1.x to 2.x. As the application use Struts1.x, it became bit difficult as nigrating to Struts 2.x is a huge task which will not fit into the time frame.
So before implementing the struts 1.x with Tiles 2 in the application directly, I was trying to convert a sample struts1.x/Tiles 1.x project to Struts 1.x/Tiles 2.x. That is where all this issues poped up. 
Back to the issue:
Once the page is loaded, there was a validator issue while clicking on a link. upn the server startup itself it was displaying an error:java.lang.NoSuchMethodError: org.apache.commons.validator.ValidatorResources.<init>([Ljava/net/URL;)V at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:251) at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:174) at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:891)
when I changed the commons-validator.jar TO commons-validator-1.4.0,jar, that error went off. But while clicking the link it displays a message in the console as below:
:-8000-00000000000004f5,0] [APP: sampleTiles2] Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory:-8000-00000000000004f5,0] [APP: sampleTiles2] Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory:-8000-00000000000004f5,0] [APP: sampleTiles2] Cannot find TilesContextFactory class org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory00-00000000000004f5,0] [APP: sampleTiles2] Cannot find TilesRequestContextFactory class org.apache.tiles.portlet.context.PortletTilesRequestContextFactory00-00000000000004f5,0] [APP: sampleTiles2] Unable to find configured definition '/WEB-INF/tiles.xml' [APP: sampleTiles2] The created container is not instance of KeyedDefinitionsFactoryTilesContainer and cannot be configured correctly
My tiles-defs.xml
    <definition name="base.definition" 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="base.definition">        <put-attribute name="title" value="Friends" />        <put-attribute name="body" value="/friends.jsp" />    </definition>    <definition name="office" extends="base.definition">        <put-attribute name="title" value="The Office" />        <put-attribute name="body" value="/office.jsp" />    </definition>

Any thoughts? :) Once again thank you for your big chink of time for this issue.
ThanksVenu

 

    On Friday, 17 March 2017 12:50 PM, Torsten Krah <[hidden email]> wrote:
 

 This seems kind of strange:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/insertAttribute.html

/baseLayout.jsp is not a name of an attribute but the template name of
the definition, looks suspicious to me.

Maybe you mean:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/insertTemplate.html

If you look here:

https://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/tld-summary.html

This looks like the one you're looking for:

<tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
                  <tiles:putAttribute name="title" value="My first
page" />
                  <tiles:putAttribute name="header"
value="/common/header.jsp" />
                  <tiles:putAttribute name="footer"
value="/common/footer.jsp" />
                  <tiles:putAttribute name="menu"
value="/basic/menu.jsp" />
                  <tiles:putAttribute name="body"
value="/basic/helloBody.jsp" />
                </tiles:insertTemplate>



Could you double check that.

kind regards

Torsten

Am Freitag, den 17.03.2017, 16:07 +0000 schrieb Venu Gopalan:
> <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>




   
Loading...