JBoss Community

__redirected.__DocumentBuilderFactory ClassCastException

created by Rodrigo Oliveira in JBoss AS 7 Development - View the full discussion

Hello everyone,

 

I am migrating some web systems that use third party libraries. One of them use its own DocumentBuilderFactory class.

 

I created a module for the libraries, and the classes in that module are being accessed fine by the applications.

 

When I try to use DocumentBuilderFactory it gives a classCastException.

 

I tryed to exclude DocumentBuilderFactory from javaee.api with both ways indicated at this post  https://community.jboss.org/message/637818#637818.

 

Neither worked and I still keep recieving the error:

java.lang.ClassCastException: __redirected.__DocumentBuilderFactory cannot be cast to javax.xml.parsers.DocumentBuilderFactory

 

Is it because __redirected.__DocumentBuilderFactory is not on javax.xml.parsers? so I guess the configuration to exclude <exclude path="javax/xml/parsers" /> would not work, right?

If so, how can I resolve this issue? Where is __redirect.__DocumentBuilderFactory? Why is Jboss trying to use it instead of my own class.

 

Thanks in advance and follows the 2 configurations I had tryed according to the answer in that post: (I also tryed many variations trying to exclude javax/xml/parsers from javaee.api)

 

<?xml version="1.0" encoding="UTF-8"?>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>

    <deployment>

        <dependencies>

            <module name="deployment.javaee.api" />

        </dependencies>

 

        <exclusions>

            <module name="javaee.api" />

        </exclusions>

    </deployment>

    <module name="deployment.javaee.api">

        <dependencies>

            <module name="javaee.api" export="true">

                <imports>

                    <exclude path="javax/xml/parsers" />

                </imports>

            </module>

        </dependencies>

    </module>

</jboss-deployment-structure>

 

or

 

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

  <deployment>

    <exclusions>

      <module name="javaee.api" />

    </exclusions>

    <dependencies>

        <module name="org.apache.commons.logging" />

    </dependencies>

  </deployment>

  <sub-deployment name="viabilidade.war">

    <exclusions>

      <module name="javaee.api" />

    </exclusions>   

    <dependencies>

        <module name="javaee.api" >

            <imports>

                <exclude-set>

                    <path name="javax/xml/parsers"/>

                </exclude-set>

            </imports>

        </module>

    </dependencies>

  </sub-deployment>

</jboss-deployment-structure>

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community