glassfish
  1. glassfish
  2. GLASSFISH-18806

Thread used to process AdminAdapter request has context class loader set

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b41
    • Fix Version/s: 4.0_b71
    • Component/s: grizzly-kernel
    • Labels:
      None

      Description

      The AdminAdapter is a Grizzly Adapter. When the onMissingResource method is called, the context class loader is already set in the Thread. It isn't clear where this is being set. Is it from some previous request that used that thread? Is Grizzly setting this?

      The class loader is a Felix class loader.

      It seems that a thread used to process a Grizzly request should not have the context class loader already set.

        Activity

        Hide
        Tom Mueller added a comment -

        Reassigning to the hk2 component.

        The HK2Dispatcher class (in the nucleus/core/kernel) module is setting the context class loader for requests that are handled by an HttpAdapter to the adapter class loader even when the context class loader that is passed in for that class is null. It isn't clear why the HK2Dispatcher class is doing this. It isn't even clear why we have the HK2Dispatcher class, since most of it is commented out now.

        Please evaluate whether HK2Dispatcher is still needed and if it isn't, then delete it.

        Show
        Tom Mueller added a comment - Reassigning to the hk2 component. The HK2Dispatcher class (in the nucleus/core/kernel) module is setting the context class loader for requests that are handled by an HttpAdapter to the adapter class loader even when the context class loader that is passed in for that class is null. It isn't clear why the HK2Dispatcher class is doing this. It isn't even clear why we have the HK2Dispatcher class, since most of it is commented out now. Please evaluate whether HK2Dispatcher is still needed and if it isn't, then delete it.
        Hide
        jwells added a comment -

        I have removed HK2Dispatcher. However, I replicated the code that was setting the CCL in ContainerMapper since I did not want to break anything. However, that should make it clear that it has nothing to do with HK2 anymore.

        If you look at ContainerMapper you will see the method I added. It does make the logic more clear and obviously can now be handled directly in the ContainerMapper without worrying about how it would affect anything else.

        Show
        jwells added a comment - I have removed HK2Dispatcher. However, I replicated the code that was setting the CCL in ContainerMapper since I did not want to break anything. However, that should make it clear that it has nothing to do with HK2 anymore. If you look at ContainerMapper you will see the method I added. It does make the logic more clear and obviously can now be handled directly in the ContainerMapper without worrying about how it would affect anything else.
        Hide
        jwells added a comment -

        I would also like to add that I have no idea why this code used to set the CCL to the adapter if no ClassLoader was passed to it. To me that doesn't seem correct in this instance...

        Show
        jwells added a comment - I would also like to add that I have no idea why this code used to set the CCL to the adapter if no ClassLoader was passed to it. To me that doesn't seem correct in this instance...
        Hide
        Ryan Lubke added a comment -

        After a brief discussion with Tom, we both agree we'll probably never really know the purpose of this code and to go ahead and try to remove it.

        Show
        Ryan Lubke added a comment - After a brief discussion with Tom, we both agree we'll probably never really know the purpose of this code and to go ahead and try to remove it.
        Hide
        Ryan Lubke added a comment -

        Sending nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ContainerMapper.java
        Transmitting file data .
        Committed revision 58191.

        Show
        Ryan Lubke added a comment - Sending nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ContainerMapper.java Transmitting file data . Committed revision 58191.

          People

          • Assignee:
            Ryan Lubke
            Reporter:
            Tom Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: