The database is already in use by another process

The tech that installed Openfire is no longer with us, so I’m not that familiar with it, but I get to support it now.

The password was changed for the user account that originally installed Openfire and I’m pretty sure that’s when it broke. I was able to reset the password back to what it was originally but it has not fixed this problem.

I’m getting the following error when I try to open Openfire.

Database setup or configuration error: Please verify your database settings and check the logs/error.log file for detailed error messages.

java.lang.IllegalArgumentException: java.sql.SQLException: ConnectionManager.getConnection() failed to obtain a connection after 11 retries. The exception from the last attempt is as follows: java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@f7cf94a6[file =C:\Program Files\Openfire\embedded-db\openfire.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception:  java.io.IOException: The process cannot access the file because another process has locked a portion of the file : C:\Program Files\Openfire\embedded-db\openfire.lck
    at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:710)
    at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:427)
    at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:161)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:106)
    at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
    at com.exe4j.runtime.WinLauncher.main(Unknown Source)
Caused by: java.sql.SQLException: ConnectionManager.getConnection() failed to obtain a connection after 11 retries. The exception from the last attempt is as follows: java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@f7cf94a6[file =C:\Program Files\Openfire\embedded-db\openfire.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception:  java.io.IOException: The process cannot access the file because another process has locked a portion of the file : C:\Program Files\Openfire\embedded-db\openfire.lck
    at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager .java:124)
    at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:698)
    ... 16 more
ESrror starting the server. Please check the log files for more information.
erver halted

I have stopped / started the Oponfire service and rebooted the server several times to no avail.I have also tried to delete the openfire.lck file.

Any help would be much appreciated!

It was the user account creating this error. It’s working again.

Hey, I’m having the same problem but i dont know how to identify if there is an account that is creates that conflict…and how to solve it?? thanks in advance.

If you see messages similar to this, then it is unlikely that the root cause of the problem is a missing user account:

The database is already in use by another process: org.hsqldb.persist.NIOLockFile@f7cf94a6[file =C:\Program Files\Openfire\embedded-db\openfire.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: java.io.IOException: The process cannot access the file because another process has locked a portion of the file : C:\Program Files\Openfire\embedded-db\openfire.lck

Most likely, Openfire is started twice, or was shut down incorrectly.

To resolve this problem:

  1. Shut down Openfire
  2. Ensure that no other Openfire processes are running
  3. Delete the file C:\Program Files\Openfire\embedded-db\openfire.lck
  4. Restart Openfire