Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting ClassCastException while building the Hibernate Session Factory

 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting ClassCastException while building the hibernate session factory.
The hibernate session factory gets built without any error on my local setup which is exactly same as prod setup.
However this error does not occures always. The hibernate session factory gets built always but sometimes I get to see this error in the tomcat logs and thus my application stops working.
As a workaround we take a reboot on the tomcat server and the problem gets solved.
Below is the code I use for getting sessions from the session factory.



The exception I receive in the logs is



I don't understand why this is happening. The same tomcat also runs some other applications.
Can this be due to some other application. This is just a guess. I am not sure of this.

Further in the exception logs provided above, I see a statement saying

Could not read mappings from resource: File.hbm.xml
and
Duplicate class/entity mapping com.yyyy.transcript.File

Is it because the HibernateSessionFactory.class may be calling a rebuildSessionFactory method().

Your help in this regard is very much appreciated.

Thanks
Rakesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic