Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8049848

(prefs) java.util.prefs.Preferences: using non-system classloader to find service prov.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 6u26
    • core-libs
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Service provider for the interface java.util.prefs.PreferencesFactory can not be found with non-system classloader.
      For example, custom preferences service provider can not be deployed with web application.
      The reason of this problem is in the method factory1() in class java.util.prefs.Preferences. It uses only ClassLoader.getSystemClassLoader() to find service provider class.
      For example, the method factory() in the same class try to use both ClassLoader.getSystemClassLoader() and Thread.currentThread().getContextClassLoader().


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      It is possible to set system property "java.util.prefs.PreferencesFactory" pointing to necessary custom PreferencesFactory. But it seems to me this method is not admissible in servers with many applications deployed.

            bpb Brian Burkhalter
            coffeys Sean Coffey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: