powered by Jive Software

Openfire doesn't start in linux. May be a timezone problem?

Hello.

I have an openfire server installed in a ubuntu 16.04 server. I have configured automatic updates in it (a cron job make a apt-get update an a apt-get dist-upgrade automatically every day at night).

This morning, openfire is not working. Clients (spark) cant connect to it and i can see this message from them

org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '_xmpp-client._tcp.192.168.0.14:5222' failed because javax.naming.NameNotFoundException: DNS name not found [response code 3]; remaining name '_xmpp-client._tcp.192.168.0.14', '192.168.0.14:5222' failed because java.net.ConnectException: Connection refused: connect
	at org.jivesoftware.smack.SmackException$ConnectionException.from(SmackException.java:255)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:612)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:850)
	at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:364)
	at org.jivesoftware.LoginDialog$LoginPanel.login(LoginDialog.java:1138)
	at org.jivesoftware.LoginDialog$LoginPanel.access$900(LoginDialog.java:369)
	at org.jivesoftware.LoginDialog$LoginPanel$3.construct(LoginDialog.java:928)
	at org.jivesoftware.spark.util.SwingWorker.lambda$new$1(SwingWorker.java:138)
	at java.lang.Thread.run(Unknown Source)

I have a connection error in firefox when i try to enter in the openfire webpage (http://192.168.0.14:9090/index.jsp) and spark can’t connect to it. I I enter to http://192.168.0.14 I can see the webpage of apache, so apache is running.

So I made a “sudo service openfire status” and i can see this:

root@OpenFire:/var/log/openfire# sudo service openfire status
â—Ź openfire.service - LSB: Start/stop openfire jabber server
   Loaded: loaded (/etc/init.d/openfire; bad; vendor preset: enabled)
   Active: active (running) since lun 2019-04-01 10:04:45 CEST; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2223 ExecStop=/etc/init.d/openfire stop (code=exited, status=0/SUCCESS)
  Process: 2444 ExecStart=/etc/init.d/openfire start (code=exited, status=0/SUCCESS)
    Tasks: 15
   Memory: 63.9M
      CPU: 2.667s
   CGroup: /system.slice/openfire.service
           └─2454 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -server -DopenfireHome=/usr/share/openfire -Dlog4j.configurationFile=/usr/share/openfire/lib/log4j2.xml -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/ope

abr 01 10:04:45 OpenFire systemd[1]: Starting LSB: Start/stop openfire jabber server...
abr 01 10:04:45 OpenFire openfire[2444]: best java alternative in: /usr/lib/jvm/java-8-openjdk-amd64/jre
abr 01 10:04:45 OpenFire openfire[2444]: Starting openfire: openfire.
abr 01 10:04:45 OpenFire systemd[1]: Started LSB: Start/stop openfire jabber server.

Aparently the openfire service is working. Mysql is running too (I have phpmyadmin installed in this server an I can access to it and see all the databases). I think that all the users and the information still are in the server.

If i see the error logs i can see a lot of errors like this.

2019.04.01 09:34:44 org.jivesoftware.openfire.XMPPServer - Database could not be accessed
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 server time zone value 'CEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
        at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager.java:156) ~[xmppserver-4.3.2.jar:4.3.2]
        at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:946) [xmppserver-4.3.2.jar:4.3.2]
        at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:648) [xmppserver-4.3.2.jar:4.3.2]
        at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:236) [xmppserver-4.3.2.jar:4.3.2]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [?:1.8.0_191]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_191]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_191]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_191]
        at java.lang.Class.newInstance(Class.java:442) [?:1.8.0_191]
        at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:92) [startup.jar:4.3.2]
        at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:56) [startup.jar:4.3.2]

I can see the error of the timezone a lot of times. I think that yesterday there was in ubuntu an update of the timezones or something as it.

If i made “date” in terminal, i can seee this

root@OpenFire:/var/log/openfire# date
lun abr 1 10:37:52 CEST 2019

The timezone in the system is set at Europe/Madrid. I think that the solution is change timezone in any place in openfire or java (but i’m not sure). But remember that i can’t access to the login page of openfire.

How can I solve it?

Openfire has trouble connecting to the database. The error is pretty well described by the message: it fails to properly process a time zone setting. There are a few ways to resolve this, as suggested by https://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue:

Either configure your server with a timezone, or add a time-zone directive in the connection string. The first thing is something you’ll need to do on the mysql-side. The last thing you can do by modifying the string that is stored in the openfire.xml file.

Ok. I solved it.

I edited this file

/etc/mysql/mysql.conf.d/mysqld.cnf

And in section [mysqld] i put the following sentence

default_time_zone='+01:00'

(remember. I live in Spain). Then, I made the following…

sudo shutdown -r now

And all begins to work normally.

But… This problem I think that was strange. Two days ago were the change from winter time to summer time (in Spain we had to advance one hour the clocks). This server was running since 2017 (i wrote this in 2019) so there were some changes from winter time to summer time, and i don’t have this problem before.

1 Like

This was also my case and I followed marcosms’s instructions. Modified
/etc/mysql/mysql.conf.d/mysqld.cnf
Restarted Ubuntu, and all works well :wink: