大家看看这是什么错误,十万火急 Exception report

mingwang4193 2008-05-27 09:31:02
报错如下:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
com.stuman.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:62)


root cause

java.lang.NoClassDefFoundError: org/hibernate/HibernateException
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
java.lang.Class.getConstructor0(Class.java:2640)
java.lang.Class.newInstance0(Class.java:321)
java.lang.Class.newInstance(Class.java:303)
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.stuman.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:62)


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



SetCharacterEncodingFilter是一个转化字符编码的
这个文件是正确的,在其他工程中试过
Web.xml中这样配置
<filter>
<filter-name>SetCharsetEncodingFilter</filter-name>
<filter-class>com.stuman.util.SetCharacterEncodingFilter </filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
SetCharacterEncodingFilter文件内容
package com.stuman.util;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class SetCharacterEncodingFilter implements Filter {

/**
* The default character encoding to set for requests that pass through
* this filter.
*/
protected String encoding = null;

/**
* The filter configuration object we are associated with. If this value
* is null, this filter instance is not currently configured.
*/
protected FilterConfig filterConfig = null;

/**
* Should a character encoding specified by the client be ignored?
*/
protected boolean ignore = true;

/**
* Take this filter out of service.
*/
public void destroy() {

this.encoding = null;
this.filterConfig = null;

}

/**
* Select and set (if specified) the character encoding to be used to
* interpret request parameters for this request.
*
* @param request The servlet request we are processing
* @param result The servlet response we are creating
* @param chain The filter chain we are processing
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

// Conditionally select and set the character encoding to be used
if (ignore || (request.getCharacterEncoding() == null)) {
String encoding = selectEncoding(request);
if (encoding != null)
request.setCharacterEncoding(encoding);
}

// Pass control on to the next filter
chain.doFilter(request, response);

}

/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
public void init(FilterConfig filterConfig) throws ServletException {

this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
this.ignore = true;
else if (value.equalsIgnoreCase("true"))
this.ignore = true;
else if (value.equalsIgnoreCase("yes"))
this.ignore = true;
else
this.ignore = false;

}

/**
* Select an appropriate character encoding to be used, based on the
* characteristics of the current request and/or filter initialization
* parameters. If no character encoding should be set, return
* <code>null</code>.
* <p>
* The default implementation unconditionally returns the value configured
* by the <strong>encoding</strong> initialization parameter for this
* filter.
*
* @param request The servlet request we are processing
*/
protected String selectEncoding(ServletRequest request) {

return (this.encoding);

}

}
这个错误是怎么回事,很急,请大家帮帮忙
...全文
387 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kekeemx 2008-05-29
  • 打赏
  • 举报
回复
类路径中没有包含到用到的JAR包
检查一下lib目录下是否包含了所有需要的包
zhengxin070513 2008-05-29
  • 打赏
  • 举报
回复
你在Hibernate官网上面下hibernate的相关包呀,不然的话肯定提示找不到类呀
小官同志 2008-05-29
  • 打赏
  • 举报
回复
java.lang.NoClassDefFoundError: org/hibernate/HibernateException
说明这个包没找到。引入一下就ok
laorer 2008-05-27
  • 打赏
  • 举报
回复
java.lang.NoClassDefFoundError: org/hibernate/HibernateException


你把Hibernate的相关包放到web-inf/lib目录下了不?
zhj92lxs 2008-05-27
  • 打赏
  • 举报
回复

java.lang.NoClassDefFoundError: org/hibernate/HibernateException 类没有找到


导包了吗

打开tomcat找到logs文件夹,看看错误日志

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧