Forums Register Login

at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.getServletMapping

+Pie Number of slices to send: Send
[color=#444444][/color][size=12][/size]
I have download “myfaces-example-tiles-1.1.10” from official apache web site. As it is code and I hvae create new one application it is working fine with java 1.5 and tomcat 6 in my eclipse.
This example keep jsp file page1.jsp in root folder when we move this file in any other folder it geives error.
When I put the home.jsp file in any folder it is given the error below are details what I have done and what I want and wht is the error.

Error message which I got:

An Error Occurred:
javax.faces.FacesException

Caused by:
java.io.IOException - Error including path '/template/template.jsp'. java.lang.NullPointerException: context
+- Stack Trace
javax.faces.FacesException
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderTilesView(JspTilesTwoViewHandlerImpl.java:126)
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderView(JspTilesTwoViewHandlerImpl.java:110)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:146)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:426)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:255)
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderView(JspTilesTwoViewHandlerImpl.java:92)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:146)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.tiles.TilesException: Error including path '/template/template.jsp'. java.lang.NullPointerException: context
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:427)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.renderTilesView(JspTilesTwoViewHandlerImpl.java:124)
... 31 more
Caused by: java.io.IOException: Error including path '/template/template.jsp'. java.lang.NullPointerException: context
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:201)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:419)
... 33 more



This is the project struture:::----

/MCMS/WebContent
/MCMS/WebContent/common
/MCMS/WebContent/common/footer.jsp
/MCMS/WebContent/common/header.jsp
/MCMS/WebContent/common/menu.jsp
/MCMS/WebContent/css
/MCMS/WebContent/css/tiles.css
/MCMS/WebContent/images
/MCMS/WebContent/images/logo.jpg
/MCMS/WebContent/jsp
/MCMS/WebContent/jsp/home.jsp
/MCMS/WebContent/META-INF
/MCMS/WebContent/template
/MCMS/WebContent/template/template.jsp
/MCMS/WebContent/WEB-INF
/MCMS/WebContent/WEB-INF/lib
/MCMS/WebContent/WEB-INF/tlds
/MCMS/WebContent/WEB-INF/faces-config.xml
/MCMS/WebContent/WEB-INF/struts-tiles.tld
/MCMS/WebContent/WEB-INF/tiles.xml
/MCMS/WebContent/WEB-INF/tiles-config_1_1.dtd
/MCMS/WebContent/WEB-INF/web.xml
/MCMS/WebContent/index.jsp




This is the jar file which I am using in my proect:

batik-awt-util-1.6-1.jar
batik-ext-1.6-1.jar
batik-gui-util-1.6-1.jar
batik-util-1.6-1.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-digester-1.8.jar
commons-el-1.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
commons-logging-api-1.1.jar
commons-validator-1.3.1.jar
jstl-1.2.jar
myfaces-api-1.1.8.jar
myfaces-impl-1.1.8.jar
oro-2.0.8.jar
standard-1.1.2.jar
tiles-api-2.0.5.jar
tiles-core-2.0.5.jar
tiles-jsp-2.0.5.jar
tomahawk-1.1.10.jar
xmlParserAPIs-2.0.2.jar

Web.xml:------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>MCMS</display-name>

<!-- Tiles ViewHandler config file -->
<context-param>
<description>Tiles configuration
definition files and a listener need to be defined.
the listener will initialize JspTilesViewHandlerImpl with tiles definitions.
</description>
<param-name>tiles-definitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.

Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SourceCodeServlet</servlet-name>
<servlet-class>org.apache.myfaces.shared_tomahawk.util.servlet.SourceCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/jsp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SourceCodeServlet</servlet-name>
<url-pattern>*.source</url-pattern>
</servlet-mapping>
</web-app>


faces-config.xml:---
---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl</view-handler>
</application>

<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>nav_page1</from-outcome>
<to-view-id>/jsp/home.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>

tiles.xml:---
<!DOCTYPE tiles-definitions
[
<!ENTITY % Boolean "(true|false)">
<!ENTITY % ContentType "(string|template|definition|object)">
<!ENTITY % ClassName "CDATA">
<!ENTITY % RequestPath "CDATA">
<!ENTITY % DefinitionName "CDATA">
<!ENTITY % BeanName "CDATA">
<!ENTITY % PropName "CDATA">
<!ENTITY % Location "#PCDATA">
<!ELEMENT tiles-definitions (definition+)>
<!ELEMENT definition (icon?, display-name?, description?, put-attribute*, put-list-attribute*)>
<!ATTLIST definition id ID #IMPLIED>
<!ATTLIST definition preparer CDATA #IMPLIED>
<!ATTLIST definition extends CDATA #IMPLIED>
<!ATTLIST definition name CDATA #REQUIRED>
<!ATTLIST definition role CDATA #IMPLIED>
<!ATTLIST definition template CDATA #IMPLIED>
<!ELEMENT put-attribute (#PCDATA)>
<!ATTLIST put-attribute id ID #IMPLIED>
<!ATTLIST put-attribute name CDATA #REQUIRED>
<!ATTLIST put-attribute type (string|template|definition|object) #IMPLIED>
<!ATTLIST put-attribute value CDATA #IMPLIED>
<!ATTLIST put-attribute role CDATA #IMPLIED>
<!ELEMENT put-list-attribute ( (add-attribute* | item* | bean* | add-list-attribute*)+) >
<!ATTLIST put-list-attribute id ID #IMPLIED>
<!ATTLIST put-list-attribute name CDATA #REQUIRED>
<!ATTLIST put-list-attribute role CDATA #IMPLIED>
<!ELEMENT add-attribute (#PCDATA)>
<!ATTLIST add-attribute id ID #IMPLIED>
<!ATTLIST add-attribute type (string|template|definition|object) #IMPLIED>
<!ATTLIST add-attribute value CDATA #IMPLIED>
<!ATTLIST add-attribute role CDATA #IMPLIED>
<!ELEMENT add-list-attribute ( (add-attribute* | item* | bean* | add-list-attribute*)+) >
<!ATTLIST add-list-attribute id ID #IMPLIED>
<!ATTLIST add-list-attribute role CDATA #IMPLIED>
<!ELEMENT bean (set-property*)>
<!ATTLIST bean id ID #IMPLIED>
<!ATTLIST bean classtype CDATA #REQUIRED>
<!ELEMENT set-property EMPTY>
<!ATTLIST set-property id ID #IMPLIED>
<!ATTLIST set-property property CDATA #REQUIRED>
<!ATTLIST set-property value CDATA #REQUIRED>
<!ELEMENT item (#PCDATA)>
<!ATTLIST item id ID #IMPLIED>
<!ATTLIST item classtype CDATA #IMPLIED>
<!ATTLIST item icon CDATA #IMPLIED>
<!ATTLIST item link CDATA #REQUIRED>
<!ATTLIST item tooltip CDATA #IMPLIED>
<!ATTLIST item value CDATA #REQUIRED>
<!ELEMENT description (#PCDATA)>
<!ATTLIST description id ID #IMPLIED>
<!ELEMENT display-name (#PCDATA)>
<!ATTLIST display-name id ID #IMPLIED>
<!ELEMENT icon (small-icon?, large-icon?)>
<!ATTLIST icon id ID #IMPLIED>
<!ELEMENT large-icon (#PCDATA)>
<!ATTLIST large-icon id ID #IMPLIED>
<!ELEMENT small-icon (#PCDATA)>
<!ATTLIST small-icon id ID #IMPLIED>

]>

<tiles-definitions>
<definition name="layout.example" template="/template/template.jsp" >
<put-attribute name="header" value="/common/header.jsp" />
<put-attribute name="menu" value="/common/menu.jsp" />
</definition>

<definition name="/home.tiles" extends="layout.example" >
<put-attribute name="body" value="/jsp/home.jsp" />
</definition>

</tiles-definitions>
template.jsp:--
------
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1" />
<title>Myfaces - Tiles</title>
<link rel="stylesheet" type="text/css" href="css/tiles.css" />
</head>
<f:view>
<body>
<div id="lftBar">
<f:subview id="menu">
<tiles:insertAttribute name="menu" flush="false" />
</f:subview>
</div>
<div id="level0">
<div id="level1">
<div id="topBar">
<f:subview id="header">
<tiles:insertAttribute name="header" flush="false"/>
</f:subview>
</div>
<div id="level2">
<f:subview id="content">
<tiles:insertAttribute name="body" flush="false"/>
</f:subview>
</div>
</div>
</div>
</body>
</f:view>
header.jsp:---
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"
%><h:graphicImage id="logo" url="/images/logo.jpg" />
menu.jsp:--
------
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<h:form>
<h:panelGrid columns="1" >
<h:commandLink action="nav_page1">
<h:outputText value="Page1" />
</h:commandLink>
</h:panelGrid>
</h:form>
----------------------------------------
+Pie Number of slices to send: Send
 

This example keep jsp file page1.jsp in root folder when we move this file in any other folder it geives error.

What error message is that? Is it the same you give us below?


When I put the home.jsp file in any folder it is given the error

Do you mean that the error below is shown if you move the home.jsp from the root folder? The reason may be that home.jsp is including the template file that is mentioned in the error message. And since the include is defined as a relative based on the root location after you move it somewhere else the template file can not be found anymore. The solution would be for example to fix the include to point to right location after the move.

below are details what I have done and what I want and wht is the error.

I do not see where you say what you want and what have you done. So what is it that you do want to accomplish? And why? And what have you done?
+Pie Number of slices to send: Send
Hi friends,
Thanks for response . I got the solution. I make the minor misstake details are below
I make the entry like this
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/jsp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
in web.xml
when I move the home.jsp file from in another folder problem is solved.
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2910 times.
Similar Threads
Springs tiles issue
problem in Tiles2 intrigation with jsf when we keep jsp in folder location
Stream Closed Error
DTD
How to configure tiles with JSF+Struts2 Integration ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:36:22.