最近在做一个java web的项目,平台为w7,当移植到xp上的时候,却发现了一个奇怪的问题
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket. This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable. For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required. For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271). at sun.reflect.GeneratedConstructorAccessor16.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:407) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2334) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2371) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.GeneratedConstructorAccessor12.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:407) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.bitmechanic.sql.ConnectionPool.createDriverConnection(ConnectionPool.java:468) at com.bitmechanic.sql.ConnectionPool.getConnection(ConnectionPool.java:407) at com.bitmechanic.sql.ConnectionPoolManager.connect(ConnectionPoolManager.java:442) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.stateAssets.permission.dataAccess.DataAccess.getConnection(DataAccess.java:88) at com.stateAssets.bussiness.daoImpl.ProjectApplyDaoImpl.findProjectApplyAndProcess(ProjectApplyDaoImpl.java:38) at com.stateAssets.bussiness.serviceImpl.ProjectApplyServiceImpl.findProjectApplyAndProcess(ProjectApplyServiceImpl.java:24) at com.stateAssets.permission.action.BaseAction.findProjectApplyAndProcessRecords0(BaseAction.java:109) at com.stateAssets.bussiness.action.ProjectApplyAction.findRecords0(ProjectApplyAction.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.BindException: 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:254) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) ... 88 more
上面的问题是在xp中出现的,在另外一台windows server 2008上却报了另外一个错,错误信息:
java.net.SocketException: No buffer space available (maximum connections reached?)
这个问题出现的原因我在网上找了很久,主要是因为套接字缓存区不够,导致获取不到数据库连接,microsoft官网说的非常明白,解决方法见链接http://support2.microsoft.com/kb/196271
但是为什么会出现Socket爆满呢,其中一个原因,可能是出现这个问题的时候,我是在xp上做的测试,话说当客户端访问服务端的时候,两边都得建立Socket,这时候的Socket数量就加倍了,当然就建立不到连接啊,而且若有其他程序也在消耗这个SOCKET,而SOCKET.close()是不马上释放连接的,而是设置为TIME_WAIT状态,这个时间默认是240S,也就是4分钟。这太长了,所以才出现上面的问题。
本人也许说的不太详细,推荐高手的一篇文章,见链接:http://blog.csdn.net/jinwanmeng/article/details/8809935,说的非常详细,推荐看看!
相关推荐
标题 "KB2553549,KB2577795(No buffer space available 问题)" 涉及的是Windows操作系统中的一个常见错误,即"No buffer space available (maximum connections reached?): connect"。这个错误通常发生在用户尝试...
3. 错误信息:当Socket连接池出现问题时,可能会出现错误信息,如"java.net.SocketException: No buffer space available (maximum connections reached?): listen failed"。 解决方法 要解决线程太多导致Socket...
1.解决服务器报错:java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind 2.解决Windows Server 2003/2008 R2系统BUG导致windows缓冲区已满(no buffer space),Windows...
当系统出现"No buffer space available (maximum connections reached?): JVM_Bind"错误时,意味着系统已经达到了其最大连接数,无法再建立新的网络连接。这个问题对服务的稳定性和可用性产生了重大影响,尤其是对于...
No buffer space available (maximum connections reached?): JVM_Bind 解决方案: 此问题是windows的bug,唯一解决问题的方法就是reboot,然后给系统打补丁,The problem was fixed with Microsoft's patch: ...
当MySQL数据库尝试建立超过系统允许的文件句柄数量的连接时,就会发生Too many connections错误。这通常是因为Linux的文件句柄限制导致MySQL的最大连接数受到了限制。 Linux系统中用于查看和修改文件句柄限制的命令...
"Too many connections"错误是数据库操作中常见的问题,尤其在高并发或者长时间运行的应用中。本案例实战将深入探讨这个问题的解决方案及其背后的原理。 首先,我们需要理解“Too many connections”错误的含义。这...
MySQL是一个广泛使用的关系型数据库管理系统(RDBMS),它是一个开源软件,由瑞典MySQL AB公司开发,现在由Oracle公司维护。MySQL以其高性能、可靠性和易用性而闻名,支持多种操作系统,包括Linux、Windows和macOS。...
2025: Maximum number of connections reached.** - **含义**:达到最大连接数限制。 - **解决方案**:增加最大连接数设置或减少现有连接。 **26. 2026: Message descriptor not valid.** - **含义**:消息描述符...
1、win2008 r2 or windows7 【KB2553549 KB2577795】 Windows Server 2008 R2系统BUG导致windows缓冲区已满(no buffer space),Windows核心套接字泄露问题导致操作系统套接字资源被耗尽,导致controller服务器与数据库...
- `Alt+Enter`:快速修复代码错误或警告。 - `Shift+Shift`:全局搜索功能,可以搜索类、文件、符号等。 - `Ctrl+Alt+l`:格式化代码。 - **5.2 Eclipse快捷键** - `Ctrl+h`:打开搜索框。 - `Ctrl+Shift+r`:...
最近一次安全培训,需要用到安全攻防平台,结果30几个人登录上去直接爆出500错误。不知道什么原因,后来找来SSH登录用户,密码,逐步排查,发现了Nginx worker_connections配置问题。 原来是Nginx配置文件中的worker...
MySQL错误“Too many connections”是数据库用户在尝试建立新的连接时遇到的一个常见问题。这个错误表明MySQL服务器已经达到了其允许的最大并发连接数,通常默认设置为100个。当数据库连接未正确关闭,或者应用程序...
exports = { hosts : { servers : [ { host : 'localhost' , port : 28015 } ] , buffer : 20 , //Minimum connections in pool max : 100 , //Maximum connections in pool discovery : false , db : 'lolstack_...
mysql官方告诉我们需要修改max_connections的值,那么我们怎么去修改呢?有两种方法 1、修改配置文件文件 修改/etc/my.cnf这个文件,在[mysqld]中新增max_connections=N,如果你没有这个文件请从编译源码中的support...
在windows下安装Mysql系统日志出现max_open_files: 2048 max_connections: 510 table_cache: 764 类似错误是因为 max_connections 最大连接数和max_open_files、table_cache 不匹配。适当的降低max_connections 或...
MySQL数据库在运行过程中可能会遇到“Too many connections”的错误提示,这意味着服务器上的MySQL实例达到了其最大允许的并发连接数。此问题通常由以下两种情况引起: 1. **并发连接过多**:大量的应用程序或用户...
shared" directive was used and there was no free space in shared memory. Thanks to Piotr Sikora. *) Bugfix: multiple X-Forwarded-For headers were handled incorrectly. Thanks to Neal Poole for ...
标题与描述:“Lotus Connections企业级部署” Lotus Connections是一款由IBM开发的企业社交软件平台,旨在帮助企业构建内部社交网络,促进员工之间的沟通、协作和知识共享。Lotus Connections 3.0版本在企业级部署...