问题描述
我在用HibernateTemplate调用save()时遇到下面错误:javax.servlet.ServletException:java.lang.NoClassDefFoundError:org/springframework/orm/ObjectRetrievalFailureExceptionorg.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:294)org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)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.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:710)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)com.thesis.authority.filter.EncodingFilter.doFilter(EncodingFilter.java:32)rootcausejava.lang.NoClassDefFoundError:org/springframework/orm/ObjectRetrievalFailureExceptionjava.lang.ClassLoader.defineClass1(NativeMethod)java.lang.ClassLoader.defineClass(ClassLoader.java:621)java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)org.springframework.orm.hibernate3.HibernateAccessor.getJdbcExceptionTranslator(HibernateAccessor.java:235)org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:412)org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:354)org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:612)com.thesis.database.hibernateDAO.HibernateDAO.insert(HibernateDAO.java:31)com.thesis.confirm.service.Impl.ConfirmServiceImpl.AddConfirm(ConfirmServiceImpl.java:12)com.thesis.confirm.action.ConfirmAction.add(ConfirmAction.java:53)sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)java.lang.reflect.Method.invoke(Method.java:597)org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)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.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:710)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)com.thesis.authority.filter.EncodingFilter.doFilter(EncodingFilter.java:32)rootcausejava.lang.ClassNotFoundException:org.springframework.orm.ObjectRetrievalFailureExceptionorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)java.lang.ClassLoader.defineClass1(NativeMethod)java.lang.ClassLoader.defineClass(ClassLoader.java:621)java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)org.springframework.orm.hibernate3.HibernateAccessor.getJdbcExceptionTranslator(HibernateAccessor.java:235)org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:412)org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:354)org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:612)com.thesis.database.hibernateDAO.HibernateDAO.insert(HibernateDAO.java:31)com.thesis.confirm.service.Impl.ConfirmServiceImpl.AddConfirm(ConfirmServiceImpl.java:12)com.thesis.confirm.action.ConfirmAction.add(ConfirmAction.java:53)sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)java.lang.reflect.Method.invoke(Method.java:597)org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)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.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:710)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)com.thesis.authority.filter.EncodingFilter.doFilter(EncodingFilter.java:32)noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/6.0.10logs.
这里是调用的一段源码:publicObjectinsert(Objectpo)throwsException{try{getHibernateTemplate().save(po);getHibernateTemplate().flush();returnpo;}catch(Exceptionex){thrownewRuntimeException("UnCheckedExceptionoccurwhencreatingrecord:"+ex.getMessage());}}
不知道是哪里出错了,向各位求救!~
解决方案
解决方案二:
解决了。。
解决方案三:
该回复于2011-03-14 10:29:12被版主删除
解决方案四:
该回复于2011-03-14 10:29:41被版主删除
解决方案五:
既然来了,楼主就不会让我们空手走的……
解决方案六:
人齐,结贴
解决方案七:
呵呵,你的出了什么问题.!!!!类的加载先后顺序有问题还是指向的类不存在>?
解决方案八:
怎么解决的说说