Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate casting exception

 
Joe Sal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really weird but I've been racking my brain tryin to figure this out and i haven't come up with anything.

When I try to instantiate my session, using a simple Session s = sessionFactory.getCurrentSession();, i get the exception

ERROR [DaoUtil] java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener cannot be cast to org.hibernate.event.PreInsertEventListener

google turns up a total of 2 hits, basically nothing to go on. Since this seems to be dealing with validation and such on inserts/updates, and I'm simply retrieving the session, I'm not too sure why I would be getting this at all...

any help would be GREATLY appreciated!
j.
 
Bobby Hubbard
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not alone. Same issue here. I've been looking for source code to try to debug it further to no avail. Were you able to figure this one out?


Thanks
 
robert notrobot
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well 1 yr, 7 months later...

...perhaps you are no longer developing, this issue having driven you to move into management

I have a non-answer answer.

I've hit this issue upon upgrade to Spring 2.5.5 in a Spring-Hibernate web app running in JBoss 4.0.3SP1. I was on 2.0.1 (or thereabouts) and things worked. Based on one of the (now) 4 Google hits on this, I focused on classloading in JBoss. My web app ships with the hibernate jars and worked fine prior to the Spring upgrade. Come to find that JBoss 4.0.3SP1 also ships and loads hibernate jars (jboss-home/server/default/lib). Seems somehow now suddenly there's a conflict, or the JBoss version of the hib jars is taking precedence and it's version doesn't work with the new Spring. When I remove the hibernate jars from the server install, things work.

That's ok, but I want my app's version of the jar to be used, and my impression is that as of JBoss 4.0.2 it should be being used. I'd rather not have to remove or change the JBoss config if I can help it.

btw, here's the somewhat helpful Google hit, which was probably helpful for other versions of JBoss (pre 4.0.2?):

https://jira.jboss.org/jira/browse/JBAS-1691

Any thoughts appreciated.

Any thoughts? Anyone?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic