MyFaces Core
  1. MyFaces Core
  2. MYFACES-3051

Use multiple ClassLoaders to find resources (not only ContextClassLoader)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      OSGi

      Description

      In most parts of the code we only use the ContextClassLoader to find Classes and Resources. However, in some parts we also use the ClassLoader of the current Class or of a specific Class (e.g. to use myfaces-api and/or myfaces-impl ClassLoader, see ApplicationImpl.getResourceBundle(), BeanValidator.postSetValidationGroups(), ResourceHandlerImpl.getBundle() or FactoryFinder for example).

      IMO we should unify this code and maybe provide a custom ClassLoader that encapsulates three ClassLoaders (ContextClassLoader, myfaces-api and myfaces-impl). This most certainly would solve a lot of OSGi related problems.

      WDYT?

      1. MYFACES-3051-impl-and-shared-2.patch
        41 kB
        Jakob Korherr
      2. MYFACES-3051-impl-and-shared.patch
        36 kB
        Jakob Korherr
      3. MYFACES-3051-first-draft.patch
        8 kB
        Jakob Korherr

        Issue Links

          Activity

          Jakob Korherr created issue -
          Jakob Korherr made changes -
          Field Original Value New Value
          Summary Use ClassLoaderUtils.getContextClassLoader() instead of Thread.currentThread().getContextClassLoader() Use multiple ClassLoaders to find resources (not only ContextClassLoader)
          Environment Very important for environments with SecurityManagers in place, or also in OSGi OSGi
          Description The utility method ClassLoaderUtils.getContextClassLoader() uses the SecurityManager (if installed) to get the current context ClassLoader. In most parts of the code we only use the ContextClassLoader to find Classes and Resources. However, in some parts we also use the ClassLoader of the current Class or of a specific Class (e.g. to use myfaces-api and/or myfaces-impl ClassLoader, see ApplicationImpl.getResourceBundle(), BeanValidator.postSetValidationGroups(), ResourceHandlerImpl.getBundle() or FactoryFinder for example).

          IMO we should unify this code and maybe provide a custom ClassLoader that encapsulates three ClassLoaders (ContextClassLoader, myfaces-api and myfaces-impl). This most certainly would solve a lot of OSGi related problems.

          WDYT?
          Jakob Korherr made changes -
          Link This issue is related to MYFACES-3044 [ MYFACES-3044 ]
          Jakob Korherr made changes -
          Attachment MYFACES-3051-first-draft.patch [ 12471662 ]
          Jakob Korherr made changes -
          Attachment MYFACES-3051-impl-and-shared.patch [ 12471747 ]
          Jakob Korherr made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Jakob Korherr made changes -
          Assignee Jakob Korherr [ jakobkorherr ]
          Jakob Korherr made changes -
          Attachment MYFACES-3051-impl-and-shared-2.patch [ 12471825 ]
          Jakob Korherr made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Won't Fix [ 2 ]
          Jakob Korherr made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Jakob Korherr
              Reporter:
              Jakob Korherr
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development