0
我想安裝一個Web應用程序(Keycloak)到服務器(OpenShift)。(PostgreSQL)無法打開連接到數據庫
我使用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
任何反應表示讚賞。謝謝!
'java.net.UnknownHostException:postgres'說這一切; DNS名稱'postgres'未定義。你可以在'/ etc/hosts'文件中定義它,或者將它添加到你的DNS中(通過管理員添加它)。 –