Error Starting up Openfire DB after reboot

I am getting the following message when I am launching openfire. I am using OpenFire Version 3.8.2 and Spark Version 2.6.3. We had to reboot the server because of a program uninstall (nothing to do with OpenFire). The admin console still comes up, but my login is not working

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@c69e02e3[file =C:\Program Files (x86)\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 (x86)\Openfire\embedded-db\openfire.lck

at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:770)

at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:486)

at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:216)

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:113)

at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:58)

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@c69e02e3[file =C:\Program Files (x86)\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 (x86)\Openfire\embedded-db\openfire.lck

at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager .java:151)

at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:760)

… 16 more

Error starting the server. Please check the log files for more information.

Server halted

java.sql.SQLException: The database is already in use by another process:

This means that you have two or more Openfire processes running, which try to access the same database at the same time. Maybe you run a launcher when you already have it installed and running as a service.

What do I do to correct this? I only have the one service running on the server. I am using the embedded DB

Check the running processes (with something like Process Explorer to see the whole picture better). Look for openfire.exe, openfired.exe, openfire-service or similar. If there is only one process, then this is something else. Maybe then you can stop it and go to C:\Program Files (x86)\Openfire\embedded-db\ and delete the openfire.lck manually. If there are more than one process, check your startup registries (with Autoruns or similar).

I have checked the running processes and only see the 1 process (openfire). I am now getting the following error after replacing the script file from a previous backup.

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

and now the error coming up is the following

… 16 more

ESrrerver halted

or starting the server. Please check the log files for more information.

Check the timestamp / creation date of “C:\Program Files (x86)\Openfire\embedded-db\openfire.lck”.

If no Openfire process is running you should delete “C:\Program Files (x86)\Openfire\embedded-db\openfire.lck” and start Openfire. Anyhow it should have been removed during shutdown of Openfire.

I have deleted the lck file and restarted the openfire service. Now I am receiving the original error that I previously posted

Error starting the server. Please check the log files for more information.
Server halted

From the error log file

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@c69e02e3[file =C:\Program Files (x86)\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 (x86)\Openfire\embedded-db\openfire.lck
at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager .java:151)
at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:760)

From the info log file

2016.06.05 13:30:50 org.jivesoftware.database.DbConnectionManager - Unable to get a connection from the database pool (attempt 9 out of 10).
java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@c69e02e3[file =C:\Program Files (x86)\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 (x86)\Openfire\embedded-db\openfire.lck

Use the task manager, select show process of all users and check whether Openfire is running. I assume that you did no open the database with the HSQLDB viewer.

In a CMD “net start” may list an running Openfire service.