Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HTML
Hi,
   i am having error when deploying web application build on struts and hibernet.
  the stak trace is giving below:---

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 23

20: <body>
21: 
22: <h1>Contact Manager</h1>
23: <s:actionerror xmlns:s="#unknown" />
24: 
25: <s:form action="add" method="post" xmlns:s="#unknown">
26: 	<s:textfield name="contact.firstName" label="Firstname" />


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause 

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
	org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
	org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
	org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
	org.apache.jsp.index_jsp._jspx_meth_s_005factionerror_005f0(index_jsp.java:185)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.


My web.xml file is :--



<web-app version="2.5">
	xmlns="http://java.sun.com/xml/ns/javaee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
  	<filter-name>struts2</filter-name><pre lang="xml"><pre lang="xml"><pre lang="xml"><pre lang="xml"><pre lang="xml">

<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher


<filter-mapping>
<filter-name>struts2
<url-pattern>*.action
Posted
Updated 24-Mar-13 19:15pm
v4
Comments
Gian rebollido 26-Mar-13 1:24am    
did you try to debug your code???
prabhat123.ranjan 26-Mar-13 12:23pm    
yes i have tried and the problem has been resolved. it was a wrong entry and url-mapping

also we need to know the difference between FilterDispather class and PrepareAndExcute class.

1 solution

Hello Prabhat,

Try to remove xmlns:s="#unknown" from the jsp, and also ensure that following taglib directive is present in your page.
HTML
<%@ taglib prefix="s" uri="/struts-tags" %>
Ensure that the filter is defined in web.xml as shown below (From the sample it's not clear)
XML
<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>
This definition should appear before the welcome-file-list element.

Please also ensure that the struts jar is present in WEB-INF/lib folder.
Regards,
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900