【已解决】配置OpenFire期间连接数据库出错A connection to the database could not be made

【背景】

折腾:

【记录】在CentOS 6.6中安装OpenFire

期间,在 数据库设置-标准连接 中,配置好了:

用:

jdbc:mysql://bogon:3306/openfire_xxx

openfire database config standard connection config use hostname

结果连接出错:

A connection to the database could not be made. View the error message by opening the "/logs/error.log" log file, then go back to fix the problem.

如图:

A connection to the database could not be made for openfire database

【解决过程】

1.搜:

openfire mysql A connection to the database could not be made

参考:

Openfire 3.3.2 MySQL Install Problems | Ignite Realtime

Openfire database setup error – Server Fault

算了,还是先去看对应的log文件吧,才能知道具体是什么错误。

2.结果里面都是类似于这样的:

2015.07.07 01:44:46 org.jivesoftware.util.log.util.CommonsLogFactory - Prototype
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
 at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:356)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)
 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
 at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
 at java.sql.DriverManager.getConnection(DriverManager.java:571)
 at java.sql.DriverManager.getConnection(DriverManager.java:187)
 at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
 at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
 at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
 at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)
Caused by: java.net.UnknownHostException: bogon: No address associated with hostname
 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
 at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
 at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
 at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
 at java.net.InetAddress.getAllByName(InetAddress.java:1162)
 at java.net.InetAddress.getAllByName(InetAddress.java:1098)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:250)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:306)
 ... 17 more
2015.07.07 01:45:27 org.jivesoftware.util.log.util.CommonsLogFactory - Prototype
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
 at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:356)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)
 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
 at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
 at java.sql.DriverManager.getConnection(DriverManager.java:571)
 at java.sql.DriverManager.getConnection(DriverManager.java:187)
 at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
 at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
 at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
 at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)
Caused by: java.net.UnknownHostException: bogon: No address associated with hostname
 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
 at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
 at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
 at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
 at java.net.InetAddress.getAllByName(InetAddress.java:1162)
 at java.net.InetAddress.getAllByName(InetAddress.java:1098)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:250)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:306)
 ... 17 more

没有想要的错误信息。

3.再去试试用localhost:

change hostname to localhost

结果就可以了:

可以继续了:

can continue to do features config openfire

 

【总结】

对于OpenFire中的数据库配置期间,

不能用 hostname形式(因为此处的hostname是无效的):

jdbc:mysql://bogon:3306/openfire_xxx

而是需要改用localhost:

jdbc:mysql://localhost:3306/openfire_xxx

即可。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量