3 Replies Latest reply on Dec 10, 2012 3:46 AM by cberger

    What's the purpose of defining redirections for JRE-Classes in JBoss AS 7?

    cberger

      Hey guys,

       

      it would be nice if someboy could tell me why JBoss defines these redirections:

       

      javax.xml.parsers.SAXParserFactory = __redirected.__SAXParserFactory
      javax.xml.stream.XMLEventFactory = __redirected.__XMLEventFactory
      javax.xml.stream.XMLInputFactory = __redirected.__XMLInputFactory
      javax.xml.stream.XMLOutputFactory = __redirected.__XMLOutputFactory
      javax.xml.transform.TransformerFactory = __redirected.__TransformerFactory
      javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema = __redirected.__SchemaFactory
      javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom = __redirected.__XPathFactory
      

       

      I've found a lot of articles about ClassNotFoundExceptions related to these redirected classes. I'm familiar with the fundamental principle of the jboss modular class loading environment but I do not understand why I get these exceptions occasionally.

      As I understand, there is a problem with the implementaions when they load classes dynamically (e.g. Class.forName()). Because in this case, the wrong CL could be used (eg. TCCL). But why is this only sometimes the case?

       

      I would be very pleased if somebody can give a comprehensive description of how jboss-modules, these redirections and the wrong way of using CL relates to each other to get this result:

       

      03:48:28,161 ERROR [stderr] Caused by: java.lang.ClassNotFoundException: __redirected.__XMLInputFactory
      03:48:28,162 ERROR [stderr]     at java.lang.Class.forName(Class.java:139)
      03:48:28,163 ERROR [stderr]     at javax.xml.stream.FactoryFinder.newInstance(Unknown Source)
      03:48:28,171 ERROR [stderr]     at javax.xml.stream.FactoryFinder.find(Unknown Source)
      03:48:28,171 ERROR [stderr]     at javax.xml.stream.FactoryFinder.find(Unknown Source)
      

       

      Thanks in advance

       

      Christian