我在tomcat 7.50上有一个应用程序,在单个请求上工作正常但是在许多同时请求(~1200)我得到了:
2014-11-02 11:22:48,485 ERROR [MONITOR-AGENT ] Connection to http://localhost:9080 refused from url http://localhost:9080/monitorLog/monitor?id=21812&name=sv17222_DB82C_201410282357.log...
2014-11-02 11:22:48,485 ERROR [MONITOR-AGENT ] Connection to http://localhost:9080 refused
org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:9080 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:941)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)
at com.securegion.monitoragent.monitor.MonitorAgent.httpGet(MonitorAgent.java:291)
at com.securegion.monitoragent.monitor.MonitorAgent.monitor(MonitorAgent.java:239)
at com.securegion.monitoragent.monitor.MonitorAgent.check(MonitorAgent.java:203)
at com.securegion.monitoragent.engine.Agent.run(Agent.java:35)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
... 14 more
我的server.xml连接器:
<Connector port="9080" protocol="HTTP/1.1"
connectionTimeout="60000"
redirectPort="8443" keepAliveTimeout = "-1"
maxThreads="150" acceptCount="1500"/>
如果某些请求被拒绝并且将在下一次迭代中解决,那很好,但只有少数(~5)在服务器给我那些消息之前取得成功
答案 0 :(得分:0)
问题实际上是内存问题。通过删除-Xmx属性释放一些堆栈内存后,问题就解决了