Uploaded image for project: 'JBoss Modules'
  1. JBoss Modules
  2. MODULES-155

For JAXP bootstrap call __RedirectedUtils.changeAll() with the application module if -jaxpmodule is not set

    XMLWordPrintable

Details

    Description

      __RedirectUtils.initAll() kicks in too early and looks at the services from the classpath to set the fallback factories. So you end up with the default com.sun implementations as the fallbacks in the __XXXXXFactory classes.

      At runtime once booted, for example __XMLInputFactory checks the TCCL to load up the services required. If the TCCL is the application module, it will load up the factory intended but if the TCCL is something else, it will not find any defined services and load up the fallback (which is the wrong com.sun class)

      [3:07pm] kkhan: dmlloyd: https://github.com/jbossas/jboss-as/pull/4014#issuecomment-13182983 What I found, is there seems to be no redirection unless it is set
      [3:07pm] jbossbot: git pull req [jboss-as] (open) kabir AS7-6338 Remove -jaxpmodule from start scripts https://github.com/jbossas/jboss-as/pull/4014
      [3:07pm] jbossbot: jira AS7-6338 Remove -jaxpmodule from start scripts [Open (Unresolved) Task, Minor, Brian Stansberry] https://issues.jboss.org/browse/AS7-6338
      [3:08pm] kkhan: dmlloyd: So without that changeAll() call what happened was
      [3:08pm] kkhan: I set up org.jboss.as.standalone to import the modules containing the services
      [3:10pm] kkhan: When parsing xml from some deployment processor for EJBSecurityTestCase
      [3:10pm] kkhan: the TCL used is org.jboss.as.server
      [3:10pm] dmlloyd: that's all I'd expect would be needed
      [3:10pm] kkhan: which then falls back to the bootstrap thing
      [3:11pm] kkhan: But could it not be the case that for whatever reason people call XXXFactory.newInstance() from somewhere that does not have that as the TCCL?
      [3:11pm] kkhan: bootstrap thing = whatever comes from the classpath services, which is com.sun default impl
      [3:13pm] kkhan: dmlloyd: Perhaps the real problem is that __RedirectedUtils.initAll() kicks in too early, it looks for the services on the classpath rather than on the module passed in to modules main()
      [3:13pm] dmlloyd: the TCCL shouldn't matter
      [3:13pm] dmlloyd: all the redirection does is say "if no TCCL, use the implementation I have selected"
      [3:13pm] dmlloyd: (where said implementation comes from a module)
      [3:14pm] dmlloyd: that's how it's supposed to work anyway
      [3:14pm] dmlloyd: Nihility: does that match your recollection?
      [3:15pm] kkhan: dmlloyd: What happens without those calls is
      [3:15pm] kkhan: modules main() calls initAll() which initializes that stuff from classpath
      [3:16pm] kkhan: so it just uses the com.sun stuff as the 'default'
      [3:16pm] kkhan: __DocumentBuilderFactory uses the TCCL to see if anything different from what is in the redirect should be used
      [3:17pm] jmesnil was granted voice by ChanServ.
      [3:17pm] jmesnil joined the chat room.
      [3:17pm] kkhan: TCCL may or may not be org.jboss.as.server, so if not we'd end up with the com.sun builder rather than the one from the org.jboss.as.server services
      [3:18pm] kkhan: The calls I made to changeAll() make sure that the default is the one from the services
      [3:19pm] dmlloyd: hmm I think I see what you mean
      [3:19pm] kkhan: The thing that pointed me to this was that originally I made org.jboss.as.standalone the module importing these services, the deployment processor (whose name I can't find at the moment) was using org.jboss.as.server which did not have those services
      [3:19pm] kkhan: since standalone is the thing we boot
      [3:19pm] dmlloyd: really we should probably be calling changeAll() with the application module if no jaxpmodule is given
      [3:19pm] dmlloyd: which makes initAll() kind of obsolete
      [3:21pm] kkhan: Or initAll should be called a little bit later, although that means the first module.xml gets read with the com.sun varieties
      [3:21pm] kkhan: Ah, I see what you mean
      [3:22pm] kkhan: dmlloyd: Is this something that can be fixed now, or should I open a modules JIRA and reference that from the comments in my code?
      [3:23pm] dmlloyd: let's do a modules JIRA
      [3:24pm] dmlloyd: seems like a pretty major oversight
      [3:24pm] dmlloyd: tbh I don't like initAll because it's called from a class static init
      [3:24pm] dmlloyd: which I'm trying to wean off of...

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              kkhan1@redhat.com Kabir Khan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: