This error occurs during the first running!
Exception
Javax. servlet. ServletException: Servlet execution threw an exception
Root cause
Java. lang. ExceptionInInitializerError
Classmate. HibernateUtil. <clinit> (HibernateUtil. java: 35)
Classmate. DbOperate. getUser (DbOperate. java: 25)
Classmate.LoginAction.exe cute (LoginAction. java: 27)
Org. apache. struts. action. RequestProcessor. processActionPerform (RequestProcessor. java: 419)
Org. apache. struts. action. RequestProcessor. process (RequestProcessor. java: 224)
Org. apache. struts. action. ActionServlet. process (ActionServlet. java: 1194)
Org. apache. struts. action. ActionServlet. doPost (ActionServlet. java: 432)
Javax. servlet. http. HttpServlet. service (HttpServlet. java: 709)
Javax. servlet. http. HttpServlet. service (HttpServlet. java: 802
The corresponding statement in the program is the THROW statement throw new ExceptionInInitializerError (ex );
The details are as follows:
Try {
SessionFactory = new Configuration (). configure (). buildSessionFactory ();
} Catch (Throwable ex ){
Ex. printStackTrace (); // TODO: handle exception
Throw new ExceptionInInitializerError (ex );
}
This error occurs during the second operation!
The above error only appears once!
Then this error always occurs!
Error message: Root cause
Java. lang. NoClassDefFoundError
The corresponding sentence in the program:
Session session = HibernateUtil. currentSession ();
Solution:
Put the JAR10 required packages of HIBERNATE
COPY to the LIB directory of the project
(If you build a path in JAVA, add the external JAR package, add the required packages, and COPY them to the LIB directory of the job !)