Error ‘weblogic.management.ManagementException: Unable to obtain lock on WLS_SERVER.lok.’ on Starting Weblogic Server

When trying to start Weblogic server unable start successfully and in the logs can see below error

<BEA-141297> <Could not get the server file lock. Ensure that another server is not running in the same directory. Retrying for another 60 seconds.>

Following error might also be observed:
<BEA-171519> <Could not obtain an exclusive lock to the embedded LDAP data files directory: $WLS_Domain/servers/$Server_Name/data/ldap/ldapfiles because another WebLogic Server instance is already using this directory. Ensure that the first WebLogic Server instance is completely shut down and restart the server.>

There can be 2 reasons for this issue:

  • 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. This error indicates that server user tried to restart is already up & running.
  • This issue can come up if the server didn’t previously shut down gracefully and thus couldn’t unlock (delete) its lok files.

Below commands help to check running process ,Port status and lock files

Use ps -eaf | grep java
Use netstat -tnpl | grep-i LISTEN | grep <SERVER_LISTEN_PORT>
find . -name '*.lok' to find all the lock files run from WLS_DOMAIN location

If its verified that server is not running already, delete [server name].lok file. This file is placed in $WLS_Domain/servers/$Server_Name/tmp directory.
If error is observed for EmbeddedLDAP.lok file as well, delete it too. This file is placed in $WLS_Domain/servers/$Server_Name/data/ldap/ldapfiles directory.

Once above checks are completed then try to start the Weblogic .It should come up successfully . Verify the logs if didnt come up could be because of some other error .

If the JVM started successfully then you can seee RUNNING status on the logs .

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *