日期:2014-05-17  浏览次数:20727 次

NoClassDefFoundError, 不能initialize HibernateUtil,请教大家
错误信息如下,我用的myeclipse,已经把hibernate的包都导入了,确认版本和classpath路径都没有错。
做跟踪的时候,一到通过hibernate操作数据库的时候就出错了。调了两天了也没有调通,希望高手指点!谢谢!


HTTP Status 500 -

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: Could not initialize class cn.com.shoppingonline.HibernateUtil
cn.com.shoppingonline.DbOperate.getSorts(DbOperate.java:121)
cn.com.shoppingonline.FirstAction.execute(FirstAction.java:25)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

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

------解决方案--------------------
你看一下是不是跟myeclipse自带的包冲突了
------解决方案--------------------
确认版本和classpath路径都没有错。
杂确认的呢?
getSorts(DbOperate.java:121) 
写啥了 贴下
------解决方案--------------------
LS的没有错 是包的冲突

这个也是myeclipse的BUG
------解决方案--------------------
java.lang.NoClassDefFoundError: Could not initialize class cn.com.shoppingonline.HibernateUtil 
包冲突??cn.com.shoppingonline.HibernateUtil 这个类明显是楼主自己写的,跟myeclipse有什么关系
------解决方案--------------------
你在程序里面对HibernateUtil 做了封装吗?
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html