This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Application Frameworks and the fly likes Getting ClassCastException while building the Hibernate Session Factory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Getting ClassCastException while building the Hibernate Session Factory" Watch "Getting ClassCastException while building the Hibernate Session Factory" New topic
Author

Getting ClassCastException while building the Hibernate Session Factory

rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
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


Rakesh Kadulkar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting ClassCastException while building the Hibernate Session Factory