Exception in thread "main" org.apache.http.conn.HttpHostConnectException:Connection to http://10.5.20.96:8011 refused
At Org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection ( defaultclientconnectionoperator.java:190)
At Org.apache.http.impl.conn.ManagedClientConnectionImpl.open (managedclientconnectionimpl.java:294)
At Org.apache.http.impl.client.DefaultRequestDirector.tryConnect (defaultrequestdirector.java:640)
At Org.apache.http.impl.client.DefaultRequestDirector.execute (defaultrequestdirector.java:479)
At Org.apache.http.impl.client.AbstractHttpClient.execute (abstracthttpclient.java:906)
At Org.apache.http.impl.client.AbstractHttpClient.execute (abstracthttpclient.java:1066)
At Org.apache.http.impl.client.AbstractHttpClient.execute (abstracthttpclient.java:1044)
At Org.apache.http.impl.client.AbstractHttpClient.execute (abstracthttpclient.java:1035)
At Com.tudou.findlabel.entrance.ClientWithResponseHandler.main (clientwithresponsehandler.java:52)
caused By:java.net.ConnectException:Connection refused:connect
At Java.net.PlainSocketImpl.socketConnect (Native Method)
At Java.net.PlainSocketImpl.doConnect (plainsocketimpl.java:333)
At Java.net.PlainSocketImpl.connectToAddress (plainsocketimpl.java:195)
At Java.net.PlainSocketImpl.connect (plainsocketimpl.java:182)
At Java.net.SocksSocketImpl.connect (sockssocketimpl.java:366)
At Java.net.Socket.connect (socket.java:519)
At Org.apache.http.conn.scheme.PlainSocketFactory.connectSocket (plainsocketfactory.java:127)
At Org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection ( defaultclientconnectionoperator.java:180)
... 8 more
This is because Linux does not open on the 8011 port access caused by. The following command enables you to open a network port that allows for external access:
/sbin/iptables-i input-p TCP--dport 8011-j ACCEPT #开启8011端口/etc/rc.d/init.d/iptables Save #保存配置/etc/rc.d/init.d/ipta Bles Restart #重启服务 See if the port is open/etc/init.d/iptables status results are as follows
Linux firewall to open the relevant port and view the open port