[jboss-user] [Beginner's Corner] - Re: JBOSS 5.1 Server -> org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider

Fabio Schmitz Tani do-not-reply at jboss.com
Wed Sep 29 07:28:21 EDT 2010

Fabio Schmitz Tani [http://community.jboss.org/people/fstani] created the discussion

"Re: JBOSS 5.1 Server -> org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider"

To view the discussion, visit: http://community.jboss.org/message/563834#563834


I've had similar problems, what I can tell you is that you can bundle your hibernate jars with your web application, and use a classloading configuration with jboss-web.xml to force JBoss to load jars from your application first, and then from common/lib, this way you can stop receiving this kinds of errors because of duplicate libraries that are bundled with JBoss.

The solution is documented here:
 http://community.jboss.org/docs/DOC-9288 http://community.jboss.org/wiki/classloadingconfiguration

Here's the jist of it (jboss-web.xml inside your WAR WEB-INF folder)

   <class-loading java2ClassLoadingCompliance="false">

With that you avoid conflicting problems, the one thing you might need is to update the hibernate-validator inside the common/lib, and unfortunately I wasn't able to get around this with this configuration. If no errors appear because of it, better for you, but if you get validation error messages, you will need to replace the current validator bundled with JBoss.

Best Regards,

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100929/73a91fc5/attachment.html 

More information about the jboss-user mailing list