19

I'm trying to run multiple jvms (including tomcat) under different users on one linux box. I'm not seeing too many issues, but in catalina.out I keep seeing this:

May 30, 2014 1:16:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7626 ms
May 30, 2014 1:16:37 PM java.util.prefs.FileSystemPreferences$2 run
WARNING: Could not create system preferences directory. System preferences are unusable.
May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock System prefs. Unix error code -158097957.
May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

I did some digging/reading and deduced the following:

An administrator with root access must create the system preferences directory /etc/.java/.systemPrefs with drwxr-xr-x access.

Java's looking for /etc/.java/.systemPrefs/.system.lock and /etc/.java/.systemPrefs/.systemRootModFile

Manually creating the above files (use "touch" to create empty files) and their containing directories should fix. Rights to the files should be 544, rights to their directories should be 755, owner and group are root for all.

But

I am not root, getting someone to run root is expensive and I have multiple users running jvms, does that mean i have to create those files and set up permissions just so that all users have access with those privileges?

Has anyone ever run into this issue and if they have is there a simpler solution i am missing?

4 Answers 4

35

Set these settings per user:

mkdir -p ~/.java/.systemPrefs
mkdir ~/.java/.userPrefs
chmod -R 755 ~/.java
export JAVA_OPTS="-Djava.util.prefs.systemRoot=/home/user/.java -Djava.util.prefs.userRoot=/home/user/.java/.userPrefs"
  <run appl>

Without creating the directories, some Java virtual machines default to /etc/.

See also: Java - Setting Preferences backingstore directory

0
-1

My thinking is that even though you have different users, the JVM still reads tomcat as one user since it's the same process. Perhaps what you need is a user management mechanism? Log in and log out

-1

I fixed this by setting the permissions of my Bash program executing to 755

ls abc.sh
chmod 755 abc.sh
-1

Simply give full permission to /etc/.java

chmod -R 777 /etc/.java/

or

sudo chmod -R 777 /etc/.java/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.