Wednesday Mar 13, 2013

Potential Issues With Weblogic Server Lok Files

Certain configuration files's access sometime need to be restricted in order to only allow one Weblogic Server instance or user to access them at any specific time.  Files with .lok extension are created for this purpose.  While browsing your domain directory structure, you might find config.lok under the domain config directory.  This file exists to ensure that config.xml is being updated serially.  Edit.lok's purpose is to ensure that only one user at a time can edit the domain configuration.  Edit.lok lies in the domain directory.  Other lok files include EmbeddedLDAP.lok and server_name.lok.

Each running server creates its own server_name.lok (in \servers\server_name\tmp) and own EmbeddedLDAP.lok (in \servers\server_name\ldapfiles) while starting up.  The process ID (PID) that is holding the lock on these files is the same that the process which is running server_name.  This can easily be verified with the fuser Unix command or with handle on Windows.  Both files have a size of 0 byte.

MOS note 943790.1 describes these 4 files in more details.

In addition to creating these two files, the administration server also creates config.lok, also with a size of 0 byte, and edit.lok.  However edit.lok stores data such as encoded user information and various timestamps.  This file is updated as changes are being made or has the timestamp of the latest update made in the administraction console.  It's highly recommended not to delete any of these files while servers in your domain are running.  During the shutdown process, the server should delete its own EmbeddedLDAP.lok and server_name.lok and leave edit.lok and config.lok as they are.

So what can go wrong?

A server can fail to start with the critical error code BEA-000362 and a nested ManagementException reporting that it's unable to obtain lock on server_name.lok and that this server might already be running.  This issue can come up if the server didn't previously shut down gracefully and thus couldn't unlock (delete) its lok files, or simply because a process running this server still exists. At this point, and if no process is currently running this server, server_name.lok and EmbeddedLDAP.lok would need to be deleted manually for the server to startup successfully.

If EmbeddedLDAP.lok is present while a server is booting then the startup will fail with the emergency error code BEA-000342 and a nested ServiceFailureException containing Could not obtain an exclusive lock to the embedded LDAP data files directory.  One EmbeddedLDAP.lok exists for each server in the domain whereas only one edit.lok and one config.lok exist for the whole domain.

While attempting simultaneous deployments, you might encounter the warning code BEA-149124 with the message The domain edit lock is owned by another session in exclusive mode - hence this deployment operation cannot proceed. When multiple deployment tools are being used, only one can acquire a lock on the domain configuration at a given time until a deployment is complete.  The usenonexclusivelock parameter can be used with the wldeploy ant task or with weblogic.Deploy if this warning is considered an inconvenience.


The official blog for Oracle WebLogic Server fans and followers!

Stay Connected


« November 2015