[jboss-jira] [JBoss JIRA] (WFLY-11259) Wildfly 11.0.0.Final org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

Adam Bialas (Jira) issues at jboss.org
Fri Nov 2 15:56:00 EDT 2018


    [ https://issues.jboss.org/browse/WFLY-11259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13656212#comment-13656212 ] 

Adam Bialas commented on WFLY-11259:
------------------------------------

Here is the ear structure I have (need) and which works on JBoss EAP 7.1:

	aaa.ear
		- lib
			dom4j-2.1.0.jar
		- sample.ejb (requires dom4j-2.1.0.jar)
		- bbb.war (has persistence.xml so hibernate module is implicitly added, hibernate has as required dom4j module so it should load 1.6.1 version)


> Wildfly 11.0.0.Final org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
> ------------------------------------------------------------------------------------------
>
>                 Key: WFLY-11259
>                 URL: https://issues.jboss.org/browse/WFLY-11259
>             Project: WildFly
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 11.0.0.Final
>            Reporter: Adam Bialas
>            Assignee: Scott Marlow
>            Priority: Major
>
> I have an ear file which I want to deploy to the Wildfly 11.0.0.Final. In this ear file in the lib folder I have dom4j-2.0.1.jar. One of the sub deployments (war) uses JPA (no dependencies to hibernate, just to javax.javaee-api as compile only). This sub deployment contains of course the persistence.xml file. I see in the logs that when the application server starts and loads this file the following exception is thrown: 
> org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
> and the application fails to deploy.
> I checked many posts and forums on the net and as far as I understand I must exclude the dom4j provided by the application server so the jar located in the lib folder of ear can be used.
> I created jboss-deployment-structure:
> <?xml version="1.0" encoding="UTF-8"?>
> <jboss-deployment-structure>
> 	<deployment>
> 		<exclusions>
> 			<module name="org.dom4j"/>
> 		</exclusions>
> 	</deployment>
> </jboss-deployment-structure>
> Even though I get the same exception so I suppose both jars are loaded and cause problems.
> I checked how class loading works on Wildfly 11.0.0 in comparison to JBoss EAP 7.1. In both cases this class is first loaded from provided 1.6.1 jar. JBoss does not load the newer version. However, Wildfly does and here is the problem.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list