Hibernate ClassCastException in GWT hosted mode only

一个人想着一个人 提交于 2019-12-04 07:46:33

I've also faced with that problem. After some investigation, i've found out that it is special behavior of classloading of Google Eclipse Plugin + Jetty + Hibernate.

Details: In fact during running or application from eclipse the libs are loaded TWICE: first to application instance classloader and second time to web applciation classloader of jetty. Hibernate has special classloading observing during loading of sql dialects in checking classloader hierarchy and as result that instances are different.

Solution: Not real solution of this case, but i've managed to handle it with debuging GWT applcation on external server Run As -> Web Applcaition (run on external server)

Hope it helps

Applying this patch to org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.java as described in HHH-7084 did it for me (basically overriding that class with my own version just like with the jetty launcher for GWT hosted mode to get the JNDI stuff to work).

The answer is very likely a little too late to be of value for Alexander (@user845767) but may be helpful for someone else who comes here looking for a solution.

using hibernate 4.1.4 - which has this problem patched - solved the issue completely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!