Monday, February 4, 2013

WebLogic Startup fails with Unable to obtain lock on Server may already be running

The content in this blog is mostly extracted from the following page:





When you try to start weblogic server and if it fails with error message that “Unable to obtain lock on *.lok Server may already be running

________
weblogic.management.ManagementException: Unable to obtain lock on /u01/oid_domain/servers/wls_ods1/tmp/wls_ods1.lok. Server may already be running at weblogic.management. internal.ServerLocks. getServerLock (ServerLocks.java:159)
________

This could be because of two reasons

1) WebLogic Server (which you are trying to start) is already running.
2) WebLogic Server (which you are trying to start) did not stop cleanly.

When weblogic server starts, it creates two lock files
a) $DOMAIN_HOME/servers/<server_name>/tmp/<servermame>.lok
b)
$DOMAIN_HOME/servers/<server_name>/data/ldap/ldapfiles/EmbeddedLDAP.lok

When WebLogic server stops, it removes these two files.

If you hit problem, first identify if server is running on port configured for WebLogic Server by using netstat.

netstat -an | grep <WebLogic_Server_Port>
 or
netstat -ano | findstr <port #>

If server is running then you should see output like

tcp        0      0 ::ffff:<IP>:<weblogic_port>      :::* LISTEN  

(Listen here identifies that it is listening)

Note: There could be other process using this port

How to identify which port is configured for weblogic server?
To identify port configured for weblogic server open weblogic configuration file
$DOMAIN_HOME/config/config.xml and serach for listen-port

You should see entry like
<listen-port>8001</listen-port>

Note: There is one listen-port for every weblogic server (Admin & Managed)

If server is not running then you can safely remove these lok files under WebLogic server.

Note: If this is weblogic managed server (not Admin Server) then you can safely remove entire managed server directory (including sub directories) $DOMAIN_HOME/servers/<serverName> . When you start managed server again, Admin Server will create these directories.


No comments:

Post a Comment