如何修复InvalidMappingException

时间:2011-12-20 02:36:47

标签: hibernate

我从我正在使用的网络应用程序中收到此错误:

Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/mygwtapp/shared/DTO/Account.hbm.xml
Starting Jetty on port 8888
   [WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void com.mygwtapp.client.service.UserService.createUser(com.mygwtapp.shared.DTO.Account)' threw an unexpected exception: java.lang.ExceptionInInitializerError

这是我的Account.java

这是我的Account.hbm.xml and hibernate.cfg.xml

1 个答案:

答案 0 :(得分:0)

事实证明它缺少一个JAR文件:mysql-connector-java-5.1.18-bin.jar

需要在/WEB-INF/lib文件夹

并且Account.hbm.xml类名称标记:

<class name="com.mygwtapp.DTO.Account" table="account">

应该是:

<class name="com.mygwtapp.shared.DTO.Account" table="account">