我希望有人之前遇到过这种情况并且可以指出我正确的方向。我们正在使用application.conf中的代理设置(http.proxyHost,http.proxyPort和http.nonProxyHosts),只要请求的URL是http,它们似乎就可以正常工作。如果我们将主机添加到nonProxyHosts列表,并使用https向该主机发出请求,则它不起作用(示例代码和堆栈跟踪要遵循)。如果我们删除nonProxyHosts列表,请求就可以正常工作,除非它通过代理。无论主机是否在nonProxyHosts列表中,使用http的请求都可以正常工作。
任何帮助都将不胜感激。
示例代码
public static void google()
{
try
{
renderHtml(WS.url("https://www.google.com").get().getString());
}
catch (Exception e)
{
e.printStackTrace();
}
}
当http.nonProxyHosts = www.google.com并且请求为https时发生的堆栈跟踪: java.lang.RuntimeException:java.util.concurrent.ExecutionException:java.io.IOException:Remotely Closed [id:0x01f42269,/10.0.1.100:566663:> www.google.com/74.125.129.104:443] at play.libs.ws.WSAsync $ WSAsyncRequest.get(WSAsync.java:223) 在controllers.api.ContentAPI.google(ContentAPI.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在java.lang.reflect.Method.invoke(Method.java:597) at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508) at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484) at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161) at play.server.PlayHandler $ NettyInvocation.execute(PlayHandler.java:251) at play.Invoker $ Invocation.run(Invoker.java:278) at play.server.PlayHandler $ NettyInvocation.run(PlayHandler.java:229) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303) 在java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908) 在java.lang.Thread.run(Thread.java:680) 引起:java.util.concurrent.ExecutionException:java.io.IOException:远程关闭[id:0x01f42269,/10.0.1.100:566663:> www.google.com/74.125.129.104:443] 在com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:297) 在com.ning.http.client.providers.netty.NettyAsyncHttpProvider.abort(NettyAsyncHttpProvider.java:1321) 在com.ning.http.client.providers.netty.NettyAsyncHttpProvider.channelClosed(NettyAsyncHttpProvider.java:1384) 在org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:93) 在org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 在org.jboss.netty.channel.DefaultChannelPipeline $ DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:792) 在org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:145) 在org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 在org.jboss.netty.channel.DefaultChannelPipeline $ DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:792) 在org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:636) 在org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelClosed(ReplayingDecoder.java:533) 在org.jboss.netty.handler.codec.http.HttpClientCodec $ Decoder.channelClosed(HttpClientCodec.java:218) 在org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:93) 在org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92) 在org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) 在org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) 在org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:476) 在org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:631) 在org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:101) 在org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:372) 在org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:246) 在org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38) 在org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) 在org.jboss.netty.util.internal.DeadLockProofWorker $ 1.run(DeadLockProofWorker.java:42) ......还有3个 引起:java.io.IOException:远程关闭[id:0x01f42269,/10.0.1.100:566663:> www.google.com/74.125.129.104:443] ......还有25个