When you try to start weblogic server and if this 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 identifty if server is running on port configured for WebLogic Server by using netstat.
netstat -an | grep <WebLogic_Server_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.
Hitting any problem in Oracle WebLogic Server or Fusion Middleware ? Put them under comments section for reply.
Did you get a chance to download Free Interview Questions related to WebLogic? If not, download it here http://k21academy.com/weblogic-interview-question
If you want to learn Oracle WebLogic Server Administration with tons of additional features like Live Interactive Sessions, Life time access to membership portal, Free re-taking sessions for next one year, Dedicated Machine to practice, On Job Support and much more