Question: There are several files with a .lok extension in the WebLogic Server (WLS) domain directory. What are these files used for?

There are config.lok, EmbeddedLDAP.lok and XXXserver.lok files which are used by the admin server and managed server. Another lock file named edit.lok is used for the admin server only.

Why are .lok files used?

There are cases where we see the error such as:

Lock is owned by Another Session

Or

weblogic.management.ManagementException: [Deployer:149164]The domain edit lock is owned by another session in exclusive mode - hence this deployment operation cannot proceed.

These errors essentially say about the lock being owned by another process. During these cases, we need to make sure that the process releases the lock.

Here are some more details on each type of .lok file:

config.lok

The config.lok file is just used for getting a file lock on the config.xml file, in order to ensure that config file updates run serially. It will not cause any problems if it exists in the directory.

Location:

edit.lok

The edit lock is used to ensure that only one user at a time is editing the configuration. The edit lock is only used on the Admin server.

Location:

EmbeddedLDAP.lok

This file locks access to the embedded LDAP server, in order to ensure that only a single process has access to this directory server. if two processes write to the same directory server, the directory server could be corrupted.

Location:

/cfgdir/servers/[Server Name]/data/ldap/ldapfiles/

XXXServer.lok

The [server name].lok indicates that the server with name [server name] is running. This is used to prevent a server from being booted twice. If you are sure that this server process is shut down, you can delete it.

Location:

/cfgdir/servers/[Server Name]/servername.lok

Note: When a webloigc server is stopped, the embeddedLDAP.lok and XXXservername.lok are deleted automatically.