启动weblogic的时候报Unable to obtain file lock but will retry错误

There are 1 nested errors:


weblogic.management.ManagementException: Unable to obtain lock on /usr/local/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/AdminServer.lok. Server may already be running


这可能是因为两个原因:

1)WebLogic服务器(您尝试启动) 已经在运行
2)WebLogic服务器(您尝试启动) 并没有停止干净


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.

bash-3.2$ cd Middleware/

-bash-3.2$ find . -name *.lok

./user_projects/domains/adf_domain/servers/ADFServer/data/ldap/ldapfiles/EmbeddedLDAP.lok

./user_projects/domains/adf_domain/servers/AdminServer/tmp/AdminServer.lok


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.