一个struts+hibernat的问题!搞得我昨天都没有睡好!大家帮我看一下!急急急~~~~~~

DWLLONGDWL 2005-11-04 11:06:16
这个是页面出来的错误!
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


root cause

java.lang.NoClassDefFoundError: antlr/ANTLRException
org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:27)
org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:357)
org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:423)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
com.zig.student.impl.UserDao.getUser(UserDao.java:73)
com.zig.student.action.LoginAction.execute(LoginAction.java:51)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
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)


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

下面是我的UserDao里getUser()方法:

public User getUser(String userName) throws Exception {
User user = null;
try
{
Transaction tt = session.beginTransaction();
String sql = "from User as u where u.userName=:userName";
Query query = session.createQuery(sql);
query.setString("userName",userName);
List list=query.list();
if(list.size()>0)
user=(User) list.get(0);
tt.commit();
}
catch(Exception ex)
{
log.error("Hibernate",ex);
System.err.println("select data fault User");
ex.printStackTrace();
}

return user;
}
下面是我的Action:
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;
// TODO Auto-generated method stub
User user=new User();
System.out.println(loginForm.getUserName());
IUserDao iuserDao=DaoFactory.getUserDaoEntity();
try{
user=iuserDao.getUser(loginForm.getUserName());
System.out.println("aaaaaaaaa");
}
catch(Exception e){

e.printStackTrace();
}
return mapping.findForward("ss");
}
...全文
73 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zhenyang2002 2005-11-04
hibernate 下面的 lib 文件夹下有 _README.txt,看看哪些包是必须要用的,添加到你工程的 lib 文件夹下去。
回复
zhenyang2002 2005-11-04
少了 antlr.jar 包
回复
相关推荐
发帖
Java EE
创建于2007-09-28

6.7w+

社区成员

J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
申请成为版主
帖子事件
创建了帖子
2005-11-04 11:06
社区公告
暂无公告