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 /scratch/echua/view_storage/echua_featb/.jdev_user_home/system11.1.1.6.38.61.92/DefaultDomain/servers/DefaultServer/tmp/DefaultServer.lok. Server may already be running
at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:206)
at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:67)
at weblogic.management.internal.DomainDirectoryService.start(DomainDirectoryService.java:74)
at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:461)
at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:166)
at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:881)
at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:568)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:469)
at weblogic.Server.main(Server.java:71)
________
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//tmp/.lok (In this case: /scratch/echua/view_storage/echua_featb/.jdev_user_home/system11.1.1.6.38.61.92/DefaultDomain/servers/DefaultServer/tmp/DefaultServer.lok)
b)$DOMAIN_HOME/servers//data/ldap/ldapfiles/EmbeddedLDAP.lok (In this case: /scratch/echua/view_storage/echua_featb/.jdev_user_home/system11.1.1.6.38.61.92/DefaultDomain/servers/DefaultServer/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
If server is running then you should see output like
tcp 0 0 ::ffff:: :::* 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
8001
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/ . When you start managed server again, Admin Server will create these directories.