在强大的hibernet项目部署中出错 [英] having error in strust hibernet project deployement

查看:119
本文介绍了在强大的hibernet项目部署中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在struts和hibernet上部署web应用程序时遇到错误。
stak trace给出如下:---

org.apache.jasper.JasperException:在第23行处理JSP页面/index.jsp时发生异常

20:< body >
21:
22:< h1 > 联系人管理器< / h1 >
23:< s:actionerror xmlns:s = #unknown / >
24:
25:< s:form action = 添加 方法 = 发布 xmlns:s = #unknown >
26:< s:textfield name = contact.firstName label = 名字 / >


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)


根本原因

无法找到Struts调度程序。这通常是由于使用没有关联过滤器的Struts标记引起的。 Struts标记仅在请求通过其servlet过滤器时可用,该过滤器初始化此标记所需的Struts调度程序。 - [未知位置]
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 Apache Tomcat / 6。0。13。13日志中提供了根本原因的完整堆栈跟踪。


我的web.xml文件是: -



< web-app version < span class =code-keyword> = 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-名称 > struts2 < / filter -name > < pre lang = xml > < pre lang = xml > < span class =code-keyword>< pre lang = xml > < pre lang = xml > < pre lang = xml >



< filter-class>

org.apache.struts2.dispatcher.FilterDispatcher





< filter-mapping>

< filter-name> struts2

< url-pattern> *。动作

解决方案

Hello Prabhat,



尝试从jsp中删除xmlns:s =#unknown,并确保页面中存在以下taglib指令。

 <%@     taglib    前缀  =  s    uri   =  / struts-tags   %>  

确保过滤器在web.xml中定义,如下所示(从样本中不清楚)< pre lang =xml> < 过滤器 >
< filter-name > struts2 < / filter-name >
< filter-class > org.apache.struts2.dispatcher.FilterDispatcher < ; / filter-class >
< / filter >

< span class =code-keyword>< filter-mapping >
< filter-name > struts2 < / filter-name >
< ur l-pattern > / * < / url-pattern >
< / filter-mapping >

此定义应该出现在welcome-file-list元素之前。



请同时确保struts jar存在于WEB-INF / lib文件夹中。

问候,


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

解决方案

Hello Prabhat,

Try to remove xmlns:s="#unknown" from the jsp, and also ensure that following taglib directive is present in your page.

<%@ 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)

<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,


这篇关于在强大的hibernet项目部署中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆