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

parent of ModuleClassLoader different between Java 8 and 9+

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • None
    • Core
    • None

    Description

      I'm not 100% sure if it's a bug, but it's a behavioral difference between Java 8 and 9+ that actually breaks one of our (Thorntail) use cases.

      So: on Java 8, the parent classloader of each ModuleClassLoader is the classloader that loaded JBoss Modules themselves. This is actually even specified in the javadoc of ConcurrentClassLoader constructors. In Java 9+, the parent classloader is always the system classloader.

      My understanding is that JBoss Modules are typically loaded from system classloader, so there should be no difference most of the time, but in one of our (Thorntail) use cases, we load JBoss Modules from a special classloader [1]. This works just fine on Java 8, but breaks on Java 9+.

      So I'd like to ask: is there a specific reason why this behavior changes between Java 8 and 9+? I know it's been a long time, but I couldn't find anything useful in Git history. I was also able to verify that when reverting to the original behavior for Java 9+ fixes the Thorntail usecase.

      [1] For in-IDE usage, we have a special main method that spawns a new process that builds an uberjar, after that process finishes, we grab the uberjar and create a URLClassLoader on top of it. From that special classloader, we invoke our regular main method, which then loads JBoss Modules etc. However, JBoss Modules can't find a bunch of resources, because

      Attachments

        Activity

          People

            Unassigned Unassigned
            lthon@redhat.com Ladislav Thon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: