tomcat在部署时出错

时间:2011-09-10 20:53:18

标签: java tomcat

我正在使用tomcat 7.1,在4,5部署后我遇到以下错误:

SEVERE: Catalina.stop: java.net.SocketException: No buffer space available (maximum connections reached?): connect

然后我需要重新启动我的系统,因为我的互联网在发生此错误时也停止了工作。这个问题是怎么造成的,怎么解决?

我刚刚发现问题,粘贴日志。请帮帮我。

INFO [http-apr-8080-exec-14] (OrderDAO_MySqlImpl.java:287) - INSIDE THE ORDER DAO IMPL: SUBCAT IS: Cpmuter Services
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:353)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2001)

    at com.mysql.jdbc.Connection.<init>(Connection.java:716)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
    at sun.reflect.GeneratedConstructorAccessor33.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:353)
    at com.mysql.jdbc.Connection.getInstance(Connection.java:295)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at bseller.Order.dao.mysql.OrderDAO_MySqlImpl.getConnection(OrderDAO_MySqlImpl.java:264)
    at bseller.Order.dao.mysql.OrderDAO_MySqlImpl.getAllOrder(OrderDAO_MySqlImpl.java:294)
    at bseller.postadd.utils.OrderControlService.getAllOrders(OrderControlService.java:33)
    at bseller.postadd.utils.OrderManager.PopulateOrderDetail(OrderManager.java:50)
    at org.apache.jsp.SubCategoryDeails_jsp._jspService(SubCategoryDeails_jsp.java:182)

    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:927)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:652)

    at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
    at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
    at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
    at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
    at org.apache.jsp.Layout_jsp._jspx_meth_tiles_005finsert_005f1(Layout_jsp.java:244)
    at org.apache.jsp.Layout_jsp._jspService(Layout_jsp.java:137)

    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)

    at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
    at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
    at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:257)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1764)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketException: No buffer space available (maximum connections reached?): 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 java.net.Socket.connect(Socket.java:469)
    at java.net.Socket.<init>(Socket.java:366)
    at java.net.Socket.<init>(Socket.java:209)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:168)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:262)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:1926)
    ... 72 more
Sep 11, 2011 2:46:24 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception

2 个答案:

答案 0 :(得分:1)

您的应用程序是否直接使用套接字连接或数据库?也许您的应用程序会创建许多连接,但不会关闭它们。

您可以尝试输入cmd

netstat -a

并分析外国地址最常出现的情况,你知道吗 - 检查它是数据库地址还是你熟悉的。

答案 1 :(得分:1)

  

java.net.SocketException:没有可用的缓冲区空间(达到最大连接数?):connect

简单来说,这是操作系统告诉您由于资源拥塞而无法创建额外的TCP套接字。大多数操作系统都可以同时打开多少个连接。你有可能达到这个极限。

为了避免这样的问题,数据库连接通常是池化,即不是处理不再需要的连接,而是保持连接,以便重新用于将来对数据库的请求。有很多连接池库。如果从JNDI中映射的DataSource获取连接,大多数应用程序服务器也会提供池功能。

另一个可能的原因是您在使用它们后没有关闭所有连接。