主题:好象是个架构问题,没明白,高手进
严重: Servlet.service() for servlet action threw exception
java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at StrutsFormPackage.ClassesOper.getAllStu(ClassesOper.java:17)
at StrutsFormPackage.IndexAction.execute(IndexAction.java:47)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
//环境j2ee 1.4 jstl1.1 hibernate3 struts1.2 eclipse3.1.1 Myeclipse4.1
//JDK1.5 tomcat5.5
//strust -action.do
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
IndexActionForm indexActionForm = (IndexActionForm) form;
String temS = indexActionForm.getIndexTemStr();
Iterator i = null;
if(temS.equals("clas")){
i = i = ClassesOper.getAllStu();
request.setAttribute("index",i);
}else{
request.setAttribute("index",null);
}
return mapping.findForward("index");
}
//ClassesOper.getAllStu();
public static Iterator getAllStu(){
return DAOclasses.getAllStu().iterator();
}
//HibernateUtil.currentSession();
//HibernateUtil操作类
//hibernate-persistence
public static List getAllStu() {
List list=null;
try {
session = HibernateUtil.currentSession(); //开启连接
Transaction tx = session.beginTransaction(); //开启事务
Query q=session.createQuery("from Classes_table");
list=q.list();
tx.commit();
} catch (HibernateException e) { //捕捉例外
e.printStackTrace();
}finally
{
HibernateUtil.closeSession(session);
}
return list;
}
java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at StrutsFormPackage.ClassesOper.getAllStu(ClassesOper.java:17)
at StrutsFormPackage.IndexAction.execute(IndexAction.java:47)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
//环境j2ee 1.4 jstl1.1 hibernate3 struts1.2 eclipse3.1.1 Myeclipse4.1
//JDK1.5 tomcat5.5
//strust -action.do
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
IndexActionForm indexActionForm = (IndexActionForm) form;
String temS = indexActionForm.getIndexTemStr();
Iterator i = null;
if(temS.equals("clas")){
i = i = ClassesOper.getAllStu();
request.setAttribute("index",i);
}else{
request.setAttribute("index",null);
}
return mapping.findForward("index");
}
//ClassesOper.getAllStu();
public static Iterator getAllStu(){
return DAOclasses.getAllStu().iterator();
}
//HibernateUtil.currentSession();
//HibernateUtil操作类
//hibernate-persistence
public static List getAllStu() {
List list=null;
try {
session = HibernateUtil.currentSession(); //开启连接
Transaction tx = session.beginTransaction(); //开启事务
Query q=session.createQuery("from Classes_table");
list=q.list();
tx.commit();
} catch (HibernateException e) { //捕捉例外
e.printStackTrace();
}finally
{
HibernateUtil.closeSession(session);
}
return list;
}