2011-12-20 80 views
0

我從Web應用程序,現在我的工作得到這個錯誤:如何修復InvalidMappingException

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

+0

u能延長例外呢?你是從日誌中得到的嗎? – 2011-12-20 02:52:40

+0

我想出瞭解決方案。我已在下面發佈。 – xybrek 2011-12-20 03:29:16

回答

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"> 
+0

接受你的答案... – 2011-12-20 04:14:01