views:

22

answers:

1

I am using Jboss5 and I'm trying to utilize Hibernate and Spring to load in a spring dao. I'm getting an exception which seems to point to an incompatibility in jars but I'm not quite sure what is going on. I've done quite a bit of searching and I can't seem to find something specific to this besides change JBOSS versions. I am wanting to know if anyone has had any similar issues or found a way to get around this. Should I not be including the spring and hibernate jars in my ear?

Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.parsers.DocumentBuilder.setEntityResolver(Lorg/xml/sax/EntityResolver;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/springframework/beans/factory/xml/DefaultDocumentLoader, and the class loader (instance of ) for resolved class, javax/xml/parsers/DocumentBuilder, have different Class objects for the type org/xml/sax/EntityResolver used in the signature

+2  A: 

You probably have a copy of one of the XML API JARs in your WAR or EAR, like Xerces, xml-apis, or something like that. This will clash (violently) with JBoss's own.

Make sure your WAR/EAR has none of its own copies of the javax.xml libraries in its lib directory.

skaffman
Yes, this was it. I removed the hibernate dependencies from my pom.xml and then everything worked. Thanks!
Loomer