JDK-4810141 : (prefs) Support using a custom PreferenceFactory inside of a framework
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.4.0,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-01-29
  • Updated: 2005-02-07
  • Resolved: 2005-02-07
Related Reports
Duplicate :  
Description
Name: jl125535			Date: 01/29/2003


FULL PRODUCT VERSION :
C:\>java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
JBoss 2.4.4

A DESCRIPTION OF THE PROBLEM :
I would expect that the custom factory would be findable,
using some mechanism. The problem arises in application
servers which often have a boot class path that they then
supplement with jars found in magical locations(in jboss
2.4.4 the directories are the lib and lib/ext).

In the case of JBoss 2.4.4(and other app servers), the
supplemental classes included the main code of the
application server.

If the custom PreferencesFactory includes code that access
the JBoss code the Factory cannot function. In my case, I
am trying to use the JNDI services as the backing store for
preferences.

What happens is that if the class is included on the java -
classpath list the Factory cannot find the JBoss code that
it depends on. If the factory is not include on the java -
classpath list then Preferences cannot find the factory
because it insists on using the SystemClassLoader.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Create Custom PreferenceFactory
2.include the Custom Preference Factory in a jar
3.do not include this jar in the class path.
4. use jboss 2.4.4  (or Weblogic, or any other app server)
5. put jar file in the lib/ext directory

EXPECTED VERSUS ACTUAL BEHAVIOR :
I expect that there should be some mechanism to use
Preferences within an app server

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Variations of ClassNotFoundError

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER WORKAROUND :
Avoid using Preferences.userRoot() and Preferences.systemRoot().
Go directly to the system property java.util.prefs.PreferenceFactory and access 
the class directly.  Create new instance of factory class to access the 
userRoot() and systemRoot() directly.  Note that this requires that the factory 
use only statics or be a facade.
(Review ID: 159120) 
======================================================================
###@###.### 11/3/04 20:38 GMT

Comments
EVALUATION see 4788410 ###@###.### 2005-2-07 18:59:46 GMT
07-02-2005