Seeing ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory after applying JBoss EAP 7.1 CP6

Solution Verified - Updated -

Issue

  • We are seeing this exception after applying JBoss EAP 7.1 CP6 , out application is packaging dom4j.jar and the application has a JPA persistence unit in it.
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
        at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:92)
        at org.hibernate.internal.util.xml.XMLHelper$1.doWork(XMLHelper.java:33)
        at org.hibernate.internal.util.xml.XMLHelper$1.doWork(XMLHelper.java:27)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.workWithClassLoader(ClassLoaderServiceImpl.java:358)
        at org.hibernate.internal.util.xml.XMLHelper.<init>(XMLHelper.java:26)
        at org.hibernate.envers.boot.internal.EnversServiceImpl.initialize(EnversServiceImpl.java:115)
        at org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl.produceAdditionalMappings(AdditionalJaxbMappingProducerImpl.java:99)
        at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:288)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:875)
        at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
        ... 7 more

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.1 CP6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content