Name: gm110360 Date: 09/20/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686
unknown (SuSE 8.0)
ADDITIONAL OPERATING SYSTEMS :
any Unix-like system
EXTRA RELEVANT SYSTEM CONFIGURATION :
J2SDK is stored on NFS-based place (below /usr/local)
A DESCRIPTION OF THE PROBLEM :
Java 1.4 introduced the preferences API. It stores data in
certain files on the system (and hides this from the
user).
The storage position is either below the install directory
or (if the install directory is remotely mounted, e.g. by
NFS) below /etc. Both locations are normally systemwide
and only writeable by root. So, if you run your Java
programs as other user, you get arbitrary error messages
from the java.util.prefs package.
As Unix is a multi-user system, the whole idea of having a
global file for preferences storage is wrong, in my
opinion. Preferences should be stored in $HOME/.java by
default, and it should be possible to adjust this place by
an environment variable. This would lead to the
preferences being user-dependent which is the only
sensible way of doing things in Unix, as I see it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Install JDK/JRE 1.4(.1) as root in a systemwide
directory
2. Run a Java Swing application (Swing happens to use the
Preferences API somewhere)
3. Be happy with the error messages.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expecting: JVM/java.utils.prefs should create files below
user-owned storage segments, e.g. $HOME/.java
Actual: JVM/java.util.prefs tries to create files below
$JAVAHOME/.java or /etc/.java which leads to error
messages due to being unable to create the files or
directories. Reason: The global file structures are not
writeable by the non-root user.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
20.09.2002 18:15:00 java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException:
Couldn't get file lock.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER WORKAROUND :
- Make .java directory world writeable. Problem: Only the
first user will be able to work with preferences. And
admin's nightmare, of course (below /etc...)
- Install JRE/JDK for each user locally. Ridiculous and
works only if home directory is not mounted via NFS.
- Write a new Preferences implementation. But why
reinventing the wheel?
- Ignore the warnings. But they are annoying and you
cannot use the Preferences API on Unix.
(Review ID: 164796)
======================================================================
- relates to
-
JDK-8223925 No document covering default property files and system properties of the Preferences API
- Resolved