WebSphere经常报错: java.util.prefs.BackingStoreException:Couldn’t get file lock.

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:466

java.util.prefs.BackingStoreException:Couldn't get file lock.




Use of Java PreferencesProblem(Abstract)[backcolor=rgb(255,255,255)]This document provides information on checking for system preferences in Java.Resolving the problem[backcolor=rgb(255,255,255)][font=Arial, sans-serif][size=1em]You must have a system preferences directory for Java when using java.util.prefs.FileSystemPreferences.[font=Arial, sans-serif][size=1em]The errors you may see in the systemout.log (these are from a WebSphere Application Server 6.1 application server) are as follows:

Could not lock System prefs. Unix error code -266024368

[3/26/09 14:11:31:508 CDT] 00000016 prefs W Could not create system preferences directory. System preferences are unusable.
[3/26/09 14:11:33:546 CDT] 00000016 prefs W Could not lock System prefs. Unix error code 2.
[3/26/09 14:11:33:572 CDT] 0000001a SystemOut O Mar 26 2009 14:11:33--[server.startup : 2] INFO [root] - java.util.prefs.BackingStoreException: Couldn't get file lock.
[3/26/09 14:11:33:578 CDT] 0000001a SystemOut O at java.util.prefs.FileSystemPreferences.removeNode(FileSystemPreferences.java:694)

You will need to set the following JVM property; such as:


In this case, you will first have to create a directory in /examplepath/directory1 called .systemPrefs and give the appropriate user (for Websphere Application Server, it is QEJBSVR or whatever user profile your application server is using) *RWX authority to each directory in the path, including .systemPrefs.

The check for systemPreferences (different from user preferences) on the IBM i should look like this:[table=98%]
[td=4%][align=RIGHT]1.[td=96%][align=RIGHT]If you set the property java.util.prefs.systemRoot=/MyPath, this directory, plus a subdirectory of .systemPrefs, must already exist (/MyPath/.systemPrefs must exist). If it does not exist, it jumps to Step 3. (Note: It will not create a .systemPrefs directory here).
[td=4%][align=RIGHT]2.[td=96%][align=RIGHT]If you did not set the property, /etc/.java/.systemPrefs must exist or it jumps to Step 3 (again, note that it will not create a .systemPrefs directory here).
[td=4%][align=RIGHT]3.[td=96%][align=RIGHT]Assumes the directory for java.home exists and checks for .systemPrefs in the java.home, and will create .systemPrefs in java.home if it was not already there. If it creates the directory, it should log a message that it created. If it attempts to create but fails, it should log a message that says it failed.
[td=4%][align=RIGHT]4.[td=96%][align=RIGHT]Final step performed is to check that the .systemPrefs directory has write authority to it. If it does, it makes sure a file named .systemRootModFile is created into the .systemPrefs directory. If write authority does not exist, or if the .systemRootModFile already exists, no action is taken.


[backcolor=transparent][font=Arial, sans-serif][font=Arial, sans-serif]Starting WebSphere Application Server gives warning message - Could not lock User prefs

[backcolor=rgb(255,255,255)][font=Arial, sans-serif][float=left][font=Arial, sans-serif][font=Arial, sans-serif]Technote (troubleshooting)[font=Arial, sans-serif]
Problem(Abstract)[backcolor=rgb(255,255,255)]Warning message issued during the non-root startup of WebSphere stating that it can not lock the user or system preferences.Symptom[backcolor=rgb(255,255,255)][font=Arial, sans-serif][size=1em]The following message can be seen in the systemout.log:[font=Arial, sans-serif][size=1em][9/11/11 18:03:19:921 EDT] 00000001 prefs W java.util.prefs.FileSystemPreferences syncWorld Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
[9/11/11 18:03:49:929 EDT] 00000001 prefs W java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode Could not lock User prefs. Unix error code 2.
Cause[backcolor=rgb(255,255,255)][font=Arial, sans-serif][size=1em]The non-root ID that is being used to start WebSphere Application Server does not have a user_home directory. Therefore this non-root ID is unable to access the root user's "/etc/.java/.systemPrefs". This produces the aforementioned warning messages every 30 seconds in the profile_root/logs/server_name/systemout.log.

Diagnosing the problem[backcolor=rgb(255,255,255)][font=Arial, sans-serif][size=1em]You can confirm this issue by trying to start WebSphere using the "root" ID. Review the Websphere_Home/profiles//logs/ Server Types > WebSphere application servers , and select the server that you want to add the generic argument to..
[*]Then, in the Server Infrastructure section, click Java and process management > Process definition > Java virtual machine.
[*]Specify -Djava.util.prefs.userRoot=/home/wasadmin/preps for the Generic JVM Arguments property, and click OK .
[*]Click Save to save your changes.
[*]Restart the application server.