2011-12-20 35 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