[jboss-dev-forums] [JBoss AS 7 Development] - __redirected.__DocumentBuilderFactory ClassCastException

Rodrigo Oliveira do-not-reply at jboss.com
Wed Aug 22 20:53:45 EDT 2012


Rodrigo Oliveira [https://community.jboss.org/people/rodrigorjo] created the discussion

"__redirected.__DocumentBuilderFactory ClassCastException"

To view the discussion, visit: https://community.jboss.org/message/755252#755252

--------------------------------------------------------------
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#637818 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
[https://community.jboss.org/message/755252#755252]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120822/b90c6e18/attachment.html 


More information about the jboss-dev-forums mailing list