Cannot start Openfire. Database error or configuration error

Hi all,

I came into the office today to find that the Openfire server was down and nobody could communicate. I restarted the machine (server 2003) and found the error below.

It looks like I’m using the native hsqldb that came native with openfire. I searched previous posts here but couldn’t find anything that helped.

Please help!


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: error in script file line: 225 java.io.IOException: java.io.IOException: Unexpected end of command

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

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

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

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: error in script file line: 225 java.io.IOException: java.io.IOException: Unexpected end of command

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

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

… 16 more

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

Server halted

Which database are you using and is the database running / available?

LG,

Like I mentioned above, it’s the native database. Correct me if I’m wrong, but that is the file called openfire.script which does exist.

In the embedded-db folder should be openfire.script and openfire.log. As these are text files you should be able to open them with a text editor. Maybe the last line is truncated, this should be easy to verify when you open it.

error in script file line: 225 java.io.IOException: java.io.IOException: Unexpected end of command
Looking at the error message it seems that line 225 of your openfire.script file is bogus.

LG,

thanks for the tip. I went to that line and it was apparently a half line not terminated by a closing ) like the previous lines above that one. I deleted the line, restarted Openfire and while it looked like it was about to start, I got the following error:

Missing database schema for openfire. Attempting to install…

Openfire 3.7.1 [Jan 13, 2012 4:00:03 PM]

Admin console listening at:

http://127.0.0.1:9090

https://127.0.0.1:9091

Missing database schema for clientcontrol. Attempting to install…

clientcontrol - Database update failed. Please manually upgrade your database.

Starting Client Control Plugin

Missing database schema for fastpath. Attempting to install…

fastpath - Database update failed. Please manually upgrade your database.

Starting Fastpath Server

Missing database schema for monitoring. Attempting to install…

monitoring - Database update failed. Please manually upgrade your database.

Starting Monitoring Plugin

Missing database schema for packetfilter. Attempting to install…

packetfilter - Database update failed. Please manually upgrade your database.


I’m not sure how to manually upgrade my database.

Do you have a file system backup of the embedded-db folder? It may be much more easy to use it.

Unfortunately I don’t.

It looks like your database is broken. So you may want to rename the embedded-db folder and create an empty one. When you start Openfire a new database is created. Then you can re-run the initial setup.

The old openfire.script and openfire.log files should still contain the data (users, …) - so you should be able to use these files to restore users, passwords, …

Shutdown Openfire and start it again, shut it down again. Then the openfire.log file should be empty.

Then copy every INSERT statement after the “SET SCHEMA PUBLIC” line from the old openfire.script file to the current one. And copy the old openfire.log file over the new and empty openfire.log file.

After startup everything should work again as before (unless data was lost).

LG, thanks but I started from scratch and am having different issues which I’ll post in a different thread.

Thanks for your assistance.

if you are starting from scratch, I hope you migrate to ms sql or mysql. It will save you some headache in the future over using the embedded DB

You’re absolutely right!

I set it up with a MSSQL database this time around.