What product/components do you use and which version/fix level?
10.11 API Gateway
Are you using a free trial or a product with a customer license?
Internal License
What are trying to achieve? Please describe in detail.
I have created a microgateway and dockerize it by using a local API in my API Gateway as shown below.
-
.\microgateway.bat createDockerFile --docker_dir . -p 9094 -a Bookstore.zip
-
docker build -t sag:mcgw-bookstore -f Microgateway_DockerFile .
-
docker run -d -p 9094:9094 --name mcgw-bookstore sag:mcgw-bookstore
Both the docker environment and microgateway runs on my local machine. I’m able to access the response from the backend through API Gateway 5555 port via postman however when i try to get the response from 9094 via the container, the microgateway is not able to access the backend as shown in the portainer log below even though the container is healthy. How can I sort this out?
"
exception: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Unexpected error during mediationorg.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Exception during mediate()
com.softwareag.microgateway.server.MicrogatewayRuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at com.softwareag.microgateway.server.http.HttpCaller.send(HttpCaller.java:96)
at com.softwareag.pg.http.PGHttpEndpoint.send(PGHttpEndpoint.java:90)
at com.softwareag.pg.config.endpoints.DelegatorEndpoint.send(DelegatorEndpoint.java:65)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:87)
Thanks in advance,
Do you get any error messages? Please provide a full error message screenshot and log file.
at com.softwareag.apigateway.runtime.provider.policy.StageSequence.mediate(StageSequence.java:114)
at com.softwareag.apigateway.runtime.provider.policy.PolicySequence.mediate(PolicySequence.java:182)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.mediate(MicrogatewayHttpHandler.java:399)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.process(MicrogatewayHttpHandler.java:220)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.service(MicrogatewayHttpHandler.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
… 42 more
exception: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Unexpected error during mediationorg.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Exception during mediate()
com.softwareag.microgateway.server.MicrogatewayRuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at com.softwareag.microgateway.server.http.HttpCaller.send(HttpCaller.java:96)
at com.softwareag.pg.http.PGHttpEndpoint.send(PGHttpEndpoint.java:90)
at com.softwareag.pg.config.endpoints.DelegatorEndpoint.send(DelegatorEndpoint.java:65)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:87)
at com.softwareag.apigateway.runtime.provider.policy.SynapseDelegator.run(SynapseDelegator.java:46)
at com.softwareag.apigateway.runtime.provider.policy.RuntimePolicyAction.run(RuntimePolicyAction.java:60)
at com.softwareag.apigateway.runtime.provider.policy.StageSequence.mediate(StageSequence.java:114)
at com.softwareag.apigateway.runtime.provider.policy.PolicySequence.mediate(PolicySequence.java:182)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.mediate(MicrogatewayHttpHandler.java:399)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.process(MicrogatewayHttpHandler.java:220)
at com.softwareag.microgateway.server.MicrogatewayHttpHandler.service(MicrogatewayHttpHandler.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at com.softwareag.microgateway.server.http.NativeServiceCaller.invoke(NativeServiceCaller.java:69)
at com.softwareag.microgateway.server.http.HttpCaller.send(HttpCaller.java:80)
… 32 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
… 42 more
Error occurred while processing the request, Error: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5555 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Have you installed latest fixes for the products
Yes