eclipse下开发struts+hibernate出现的问题!

05-10-09 mhbjava
下面是个action,我设置断点来跟踪程序,发现当执行action里面的execute()方法时,执行到HelloForm helloForm = (HelloForm) form;这句话后就出现了异常!我不知道原因,请指点,谢谢!异常为:

java.lang.NoClassDefFoundError: org/hibernate/criterion/Criterion

com.itfly.struts.action.HelloAction.execute(HelloAction.java:52)

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)

action为:

package com.itfly.struts.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

import org.hibernate.Query;

import org.hibernate.Session;

import com.itfly.base.BaseUserDAO;

import com.itfly.dao.UserDAO;

import com.itfly.dao._RootDAO;

import com.itfly.struts.form.HelloForm;

public class HelloAction extends Action {

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) {

HelloForm helloForm = (HelloForm) form;

// TODO Auto-generated method stub

_RootDAO.initialize();

UserDAO userDAO = new UserDAO();

Session session = userDAO.getSession();

Query hql = session.createQuery("from User where Id=1");

List list = hql.list();

System.out.print(list.size());

request.setAttribute("list",list);

return mapping.findForward("success");

}

}

nova
2005-10-11 17:01
> java.lang.NoClassDefFoundError:

> org/hibernate/criterion/Criterion

看例外,是类找不到,你查看一下你的classpath吧

猜你喜欢