You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Avinash Wable <av...@persistent.co.in> on 2007/03/06 16:01:07 UTC

NullPointerException in TilesException using Tiles with Struts 2

I am trying to use Tiles with Struts 2. I have configured my application as
follows

 

When I fire http://localhost:8080/SampleStruts2/login/Login.action; I get
following error

 

20:11:40,827 ERROR [BasicTilesContainer] Error rendering tile

java.lang.NullPointerException

        at
org.apache.struts2.tiles.StrutsTilesRequestContext.include(StrutsTilesReques
tContext.java:94)

        at
org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesReque
stContext.java:83)

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

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

        at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)

        at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSuppor
t.java:178)

        at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:343)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:248)

        at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(D
efaultWorkflowInterceptor.java:213)

        at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Validati
onInterceptor.java:150)

        at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.do
Intercept(AnnotationValidationIntercetor.java:48)

        at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:86)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(Con
versionErrorInterceptor.java:123)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(Paramete
rsInterceptor.java:161)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(St
aticParametersInterceptor.java:105)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterce
ptor.java:83)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInt
erceptor.java:207)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDr
ivenInterceptor.java:74)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(S
copedModelDrivenInterceptor.java:127)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(Prof
ilingActivationInterceptor.java:107)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(Debu
ggingInterceptor.java:206)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingIn
terceptor.java:115)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nIntercepto
r.java:143)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInte
rceptor.java:115)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon
figInterceptor.java:170)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasIntercep
tor.java:123)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(Ex
ceptionMappingInterceptor.java:176)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:219)

        at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionI
nvocation.java:218)

        at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack
.java:455)

        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:216)

        at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)

        at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)

        at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:421)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
va:81)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)

        at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalVal
ve.java:39)

        at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:159)

        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
59)

        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)

        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)

        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:744)

        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)

        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
ad.java:112)

        at java.lang.Thread.run(Thread.java:595)

20:11:40,842 ERROR [[default]] Servlet.service() for servlet default threw
exception

org.apache.tiles.TilesException

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

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

        at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)

        ........

 

Anybody got the same error?

Can someone help me?

 

I am using following jars

 

freemarker-2.3.8.jar

ognl-2.6.11.jar

struts2-core-2.0.6.jar

struts2-tiles-plugin-2.0.6.jar

tiles-api-2.0-20070207.130156-4.jar

tiles-core-2.0-20070207.130156-4.jar

xwork-2.0.1.jar

 

Avinash Wable

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

RE: NullPointerException in TilesException using Tiles with Struts 2

Posted by Avinash Wable <av...@persistent.co.in>.
Actually I am using same version of tiles: 2.0 as you said i.e
for tiles.xml:
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles
Configuration 2.0//EN" "http://struts.apache.org/dtds/tiles-config_2_0.dtd">

My jsps are simple and don't use tiles tags. I am using tiles just as a
forward result type.

You can look at my configuration given below
1. tiles.xml-------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
       "http://jakarta.apache.org/struts/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
  	<definition name="login.page" path="/login/Login.jsp"/>
  	<definition name="home.page" path="/login/Home.jsp"/>
</tiles-definitions>

2. strus.xml-------------------------------------------------------------
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="login" namespace="/login" extends="tiles-default">
        <action name="Welcome" class="login.ShowLogin">
            <result name="showLogin" type="tiles">login.page</result>
        </action>
        <action name="Login" class="login.Login">
            <result type="tiles">home.page</result>
            <result name="invalidLogin" type="tiles">login.page</result>
        </action>
    </package>
</struts>

3. Login.jsp-------------------------------------------------------------
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
	<head>
		<title>Login</title>
	</head>
	
	<body>
		<s:form action="Login">
			<s:textfield label="User Name" name="username"/>
			<s:password label="Password" name="password" />
			<s:submit/>
		</s:form>
	</body>
</html>

4. Home.jsp-------------------------------------------------------------
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
	<title>Welcome</title>
	<link href="<s:url value='/css/tutorial.css'/>" rel="stylesheet"
type="text/css"/>
</head>

<body>
	<h3>Languages</h3>
	<ul>
	    <li>
	        <s:url id="url" action="HelloWorld">
	            <s:param name="request_locale">en</s:param>
	        </s:url>
	        <s:a href="%{url}">English</s:a>
	    </li>
	    <li>
	        <s:url id="url" action="HelloWorld">
	            <s:param name="request_locale">es</s:param>
	        </s:url>
	        <s:a href="%{url}">Espanol</s:a>
	    </li>
	</ul>
</body>
</html>

5. web.xml---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <display-name>Sample Struts2 Application</display-name>
    <filter>
        <filter-name>struts2</filter-name>
 
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
	<context-param>
		<param-name>org.apache.tiles.DEFINITION_CONFIG</param-name>
		<param-value>\WEB-INF\tiles.xml</param-value>
	</context-param>
	<listener>
	
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class
>
	</listener>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: NullPointerException in TilesException using Tiles with Struts 2

Posted by Aram Mkhitaryan <ar...@googlemail.com>.
Hi,

Yesterday I got the same problem,
and here is the solution:

Use new version of tiles: 2.0
for tiles.xml:
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles
Configuration 2.0//EN" "http://struts.apache.org/dtds/tiles-config_2_0.dtd">

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

tags are a little bit changed but it's easy to upgrade

for more details: http://tiles.apache.org/

Best regards,
Aram