日期:2014-05-18  浏览次数:20777 次

Hibernate开发遇到问题
问题描述:
首先,当我在hibernate.cfg.xml里面加上:<mapping resource="rims/po/ResumePO.hbm.xml" />
用户登录时就会报以下错:

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Unable to instantiate Action, rims.action.LoginAction, defined for 'userlogin' in namespace '/'entity class not found: ResumePO - action - file:/D:/ProjectSpace2_work/RIMS/WebRoot/WEB-INF/classes/struts.xml:80:68
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)


root cause 

Unable to instantiate Action, rims.action.LoginAction, defined for 'userlogin' in namespace '/'entity class not found: ResumePO - action - file:/D:/ProjectSpace2_work/RIMS/WebRoot/WEB-INF/classes/struts.xml:80:68
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:294)
...
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)

org.hibernate.MappingException: entity class not found: ResumePO
org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:89)
org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:160)
org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:42)
org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:108)
org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:211)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
rims.util.HibernateServiceProvider.initHibernate(HibernateServiceProvider.java:23)
rims.action.LoginAction.<init>(LoginAction.java:36)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
java.lang.Class.newInstance0(Class.java:355)
java.lang.Class.newInstance(Class.java:308)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
.........
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)

java.lang.ClassNotFoundException: ResumePO
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
java.lang.ClassLoader.loadClas