我们正在运行一个docker容器,该容器连接到同一服务器上的postgres数据库,但不在容器内。
我可以通过psql或pgadmin很好地连接但在docklet中我们看到来自Catalina的以下错误消息。
对未格式化的混乱道歉,但关键是以下错误即将出现:
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
这里是日志中的相关转储:
<table border="0" class="BodyTable">
<tr><td><div class="GroupHdr">Detailed Error Report</div><table class='TopError' cellSpacing='0' cellPadding='0' width='100%' border='0'><tr><td><b>There was an error while processing your request.</b></td></tr><tr><td><b>Message: </b><br/>Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.</td></tr><tr><td><b>Source: </b><br/></td></tr><tr><td><b>Stack Trace: </b><br/> at system.Data.ProviderBase.AbstractDBConnection.OnSqlException(AbstractDBConnection.cs:434)<br/> at system.Data.ProviderBase.AbstractDBConnection.Open(AbstractDBConnection.cs:505)<br/> at rdServer.rdSqlReader.<init>(Unknown Source)<br/> at rdServer.rdDb.access$4500(Unknown Source)<br/> at rdServer.rdDb.a(Unknown Source)<br/> at rdServer.rdDb.b(Unknown Source)<br/> at rdServer.rdDb.a(Unknown Source)<br/> at rdServer.rdDb.xmlGetData(Unknown Source)<br/> at rdServer.rdDb.xmlGetDataDocument(Unknown Source)<br/> at rdServer.rdDb9.xmlGetDataDocument(Unknown Source)<br/> at rdServer.PageBuilder.V(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.o(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.S(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.Q(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.R(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.o(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.S(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.Q(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.R(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.m(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.g(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.BuildHtml(Unknown Source)<br/> at rdServer.ResponseBuilder.BuildResponse(Unknown Source)<br/> at rdServer.ResponseBuilder.BuildResponse(Unknown Source)<br/> at ASP.rdpage_aspx.__Render__control1(rdPage.aspx:4)<br/> at ASP.rdpage_aspx$__Impl0.Invoke(Unknown Source)<br/> at system.Web.UI.Control.RenderChildren(Control.cs:1101)<br/> at system.Web.UI.Control.Render(Control.cs:1090)<br/> at system.Web.UI.Page.Render(Page.cs:1095)<br/> at system.Web.UI.Control.RenderControl(Control.cs:1254)<br/> at system.Web.UI.Page.RenderPage(Page.cs:1621)<br/> at system.Web.UI.Page.encodeChildren(Page.jvm.cs:159)<br/> at Mainsoft.Web.Hosting.BaseFacesViewHandler.renderView(BaseFacesViewHandler.cs:58)<br/> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)<br/> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)<br/> at Mainsoft.Web.Hosting.ServletFacesPageHandler.ProcessRequest(ServletFacesPageHandler.cs:116)<br/> at Mainsoft.Web.Hosting.SessionWrapper$SessionWrapperHandler.ProcessRequest(SessionWrapper.cs:40)<br/> at system.Web.HttpApplication$Pipelined__7.MoveNext$Z$$_$Pipeline$_$d__7$$(HttpApplication.cs:1033)<br/> at system.Web.HttpApplication.Tick(HttpApplication.cs:705)<br/> at system.Web.HttpApplication.Start(HttpApplication.cs:1217)<br/> at system.Web.HttpApplication.System_Web_IHttpAsyncHandler_BeginProcessRequest(HttpApplication.cs:1319)<br/> at system.Web.HttpRuntime.RealProcessRequest(HttpRuntime.cs:482)<br/> at system.Web.HttpRuntime.ProcessRequest(HttpRuntime.cs:523)<br/> at Mainsoft.Web.Hosting.BaseHttpServlet.service(BaseHttpServlet.cs:200)<br/> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)<br/> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)<br/> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<br/> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)<br/> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)<br/> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<br/> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)<br/> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)<br/> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)<br/> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)<br/> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)<br/> at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)<br/> at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)<br/> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)<br/> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)<br/> at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)<br/> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)<br/> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)<br/> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)<br/> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)<br/> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)<br/> at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)<br/> at java.lang.Thread.run(Thread.java:745)<br/><br/></td></tr></table><table class='InnerError' cellSpacing='0' cellPadding='0' width='100%' border='0'><tr class='InnerErrorMessage'><td><b>Inner error:</b></td></tr><tr><td><b>Message: </b><br/>Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.</td></tr><tr><td><b>Source: </b><br/></td></tr><tr><td><b>Stack Trace: </b><br/> at org.postgresql.Driver$ConnectThread.getResult(Driver.java:361)<br/> at org.postgresql.Driver.connect(Driver.java:284)<br/> at Mainsoft.Data.Jdbc.Providers.GenericProvider$JdbcUrlConnector.get_Connection(GenericProvider.cs:183)<br/> at Mainsoft.Data.Jdbc.Providers.GenericProvider.GetConnection(GenericProvider.cs:336)<br/> at system.Data.ProviderBase.AbstractDBConnection.Open(AbstractDBConnection.cs:495)<br/> at rdServer.rdSqlReader.<init>(Unknown Source)<br/> at rdServer.rdDb.access$4500(Unknown Source)<br/> at rdServer.rdDb.a(Unknown Source)<br/> at rdServer.rdDb.b(Unknown Source)<br/> at rdServer.rdDb.a(Unknown Source)<br/> at rdServer.rdDb.xmlGetData(Unknown Source)<br/> at rdServer.rdDb.xmlGetDataDocument(Unknown Source)<br/> at rdServer.rdDb9.xmlGetDataDocument(Unknown Source)<br/> at rdServer.PageBuilder.V(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.o(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.S(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.Q(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.R(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.o(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.S(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.Q(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.R(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.m(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElementChildren(Unknown Source)<br/> at rdServer.PageBuilder.g(Unknown Source)<br/> at rdServer.PageBuilder.sProcessDefinitionElement(Unknown Source)<br/> at rdServer.PageBuilder.BuildHtml(Unknown Source)<br/> at rdServer.ResponseBuilder.BuildResponse(Unknown Source)<br/> at rdServer.ResponseBuilder.BuildResponse(Unknown Source)<br/> at ASP.rdpage_aspx.__Render__control1(rdPage.aspx:4)<br/> at ASP.rdpage_aspx$__Impl0.Invoke(Unknown Source)<br/> at system.Web.UI.Control.RenderChildren(Control.cs:1101)<br/> at system.Web.UI.Control.Render(Control.cs:1090)<br/> at system.Web.UI.Page.Render(Page.cs:1095)<br/> at system.Web.UI.Control.RenderControl(Control.cs:1254)<br/> at system.Web.UI.Page.RenderPage(Page.cs:1621)<br/> at system.Web.UI.Page.encodeChildren(Page.jvm.cs:159)<br/> at Mainsoft.Web.Hosting.BaseFacesViewHandler.renderView(BaseFacesViewHandler.cs:58)<br/> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)<br/> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)<br/> at Mainsoft.Web.Hosting.ServletFacesPageHandler.ProcessRequest(ServletFacesPageHandler.cs:116)<br/> at Mainsoft.Web.Hosting.SessionWrapper$SessionWrapperHandler.ProcessRequest(SessionWrapper.cs:40)<br/> at system.Web.HttpApplication$Pipelined__7.MoveNext$Z$$_$Pipeline$_$d__7$$(HttpApplication.cs:1033)<br/> at system.Web.HttpApplication.Tick(HttpApplication.cs:705)<br/> at system.Web.HttpApplication.Start(HttpApplication.cs:1217)<br/> at system.Web.HttpApplication.System_Web_IHttpAsyncHandler_BeginProcessRequest(HttpApplication.cs:1319)<br/> at system.Web.HttpRuntime.RealProcessRequest(HttpRuntime.cs:482)<br/> at system.Web.HttpRuntime.ProcessRequest(HttpRuntime.cs:523)<br/> at Mainsoft.Web.Hosting.BaseHttpServlet.service(BaseHttpServlet.cs:200)<br/> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)<br/> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)<br/> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<br/> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)<br/> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)<br/> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<br/> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)<br/> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)<br/> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)<br/> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)<br/> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)<br/> at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)<br/> at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)<br/> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)<br/> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)<br/> at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)<br/> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)<br/> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)<br/> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)<br/> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)<br/> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)<br/> at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)<br/> at java.lang.Thread.run(Thread.java:745)<br/><br/></td></tr></table><table class='InnerError' cellSpacing='0' cellPadding='0' width='100%' border='0'><tr class='InnerErrorMessage'><td><b>Inner error:</b></td></tr><tr><td><b>Message: </b><br/>Connection refused</td></tr><tr><td><b>Source: </b><br/></td></tr><tr><td><b>Stack Trace: </b><br/> at java.net.PlainSocketImpl.socketConnect(Native Method)<br/> at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)<br/> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)<br/> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)<br/> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)<br/> at java.net.Socket.connect(Socket.java:579)<br/> at java.net.Socket.connect(Socket.java:528)<br/> at org.postgresql.core.PGStream.<init>(PGStream.java:60)<br/> at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)<br/> at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)<br/> at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:138)<br/> at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)<br/> at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)<br/> at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)<br/> at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)<br/> at org.postgresql.Driver.makeConnection(Driver.java:410)<br/> at org.postgresql.Driver.access$100(Driver.java:46)<br/> at org.postgresql.Driver$ConnectThread.run(Driver.java:321)<br/> at java.lang.Thread.run(Thread.java:745)<br/><br/></td></tr></table></td></tr>
</table>
docker容器运行它自己的独立网络,可以连接到外部网络(我们知道它成功地对另一个IP进行api调用)。我们怀疑是postgres中的一个东西导致阻塞,但此服务器上没有其他应用程序访问postgres有任何问题。