(PostgreSQL)无法打开与数据库的连接

时间:2017-07-14 05:32:37

标签: postgresql keycloak

我正在尝试将Web应用程序(Keycloak)安装到服务器(OpenShift)中。

我使用oc命令(OpenShit Client)来创建应用程序。

数据库正在运行,但我收到来自Web应用程序的错误导致安装失败。

显然,它无法连接到数据库。

05:07:04,623 ERROR [org.jgroups.protocols.JDBC_PING] (MSC service thread 1-7) Could not open connection to database: org.postgresql.util.PSQLException: The connection attempt failed.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:233)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:144)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    at org.postgresql.jdbc3g.Jdbc3gConnection.<init>(Jdbc3gConnection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:410)
    at org.postgresql.Driver.connect(Driver.java:280)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at org.jgroups.protocols.JDBC_PING.getConnection(JDBC_PING.java:336)
    at org.jgroups.protocols.JDBC_PING.delete(JDBC_PING.java:379)
    at org.jgroups.protocols.JDBC_PING.deleteSelf(JDBC_PING.java:395)
    at org.jgroups.protocols.JDBC_PING.stop(JDBC_PING.java:144)
    at org.jgroups.stack.ProtocolStack.stopStack(ProtocolStack.java:1015)
    at org.jgroups.JChannel.stopStack(JChannel.java:1002)
    at org.jgroups.JChannel.disconnect(JChannel.java:373)
    at org.wildfly.clustering.jgroups.spi.service.ChannelConnectorBuilder.stop(ChannelConnectorBuilder.java:103)
    at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:2056)
    at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:2017)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: postgres
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at org.postgresql.core.PGStream.<init>(PGStream.java:61)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:109)
    ... 22 more
05:07:04,624 ERROR [org.jgroups.protocols.JDBC_PING] (MSC service thread 1-7) Failed to delete PingData in database
05:07:04,663 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment keycloak-server.war (runtime-name: keycloak-server.war) in 116ms
05:07:04,671 INFO  [org.jboss.as] (MSC service thread 1-5) WFLYSRV0050: Keycloak 3.0.0.Final (WildFly Core 2.0.10.Final) stopped in 116ms

任何回应都表示赞赏。谢谢!

1 个答案:

答案 0 :(得分:1)

基本上,我的服务器上存在一个问题,db-name没有解析为IP地址值。

我通过提供IP地址值来修复它。