规模测试BoneCP,出现如下错误,问题核心:
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.
即,系统开不出资源!
2011-09-22 00:35:13,453 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,453 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,453 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,453 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,468 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,468 WARN ConnectionPartition - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
2011-09-22 00:35:13,468 ERROR ConnectionHandle - Failed to acquire connection. Sleeping for 7000ms. Attempts left: 5
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.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:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:729)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.GeneratedConstructorAccessor4.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:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
at com.jolbox.bonecp.ConnectionHandle.obtainInternalConnection(ConnectionHandle.java:211)
at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:170)
at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:101)
at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)
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:662)
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:218)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2027)
测试环境:xp 1.8G双核 2G内存
测试方法:只创建connection,不关闭!
系统提示:连接数限制!
解决办法:
类linux系统:查看 'ulimit' 命令. 重新设置内核或者系统参数应该就可以!
Windows平台, 请查看微软196271 (Q196271) 问题解决方案.
分享到:
相关推荐
文件 "test" 可能包含对 BoneCP 连接池的测试代码。通常,这包括单元测试和压力测试,用于验证连接池在不同负载下的行为和性能。 **JDBC 驱动** "bonecp_jdbc" 文件可能包含了 BoneCP 需要的 JDBC 驱动。在与特定...
4. `idleConnectionTestPeriod`: 检查并测试空闲连接是否有效的间隔时间,单位为秒。 5. `idleMaxAge`: 未使用的连接的最大存活时间,单位为秒。 6. `maxConnectionsPerPartition` 和 `minConnectionsPerPartition`:...
config.setJdbcUrl("jdbc:mysql://localhost:3306/mydb"); config.setUsername("root"); config.setPassword("password"); config.setMinConnectionsPerPartition(5); config.setMaxConnectionsPerPartition(10...
BoneCP 是一个轻量级、高性能的 Java 数据库连接池,本文将深入剖析其源码,理解其工作原理和实现机制。 1. **BoneCP 简介** BoneCP 是由 Jeff Smith 创建的一个开源数据库连接池,它设计的目标是提供比 C3P0 和 ...
3. **其他可能的依赖**:虽然在描述中没有明确指出,但 BoneCP 可能还需要其他的库来支持其功能,如JDBC驱动(对应于特定的数据库,如MySQL、Oracle等),这些驱动通常需要单独添加到项目中,以确保 BoneCP 能够正确...
BoneCP是一种高效的、开源的Java连接池实现,它旨在提供比其他常见的数据库连接池如C3P0和DBCP更高的性能。在这个实例中,我们将学习如何通过XML配置文件来使用BoneCP,以及如何在Java代码中加载这个配置。 首先,...
在BoneCP中,这个驱动是连接到MySQL数据库所必需的,它实现了JDBC接口,使得BoneCP可以通过JDBC API来创建、管理和关闭数据库连接。 3. **log4j-1.2.17.jar**:Log4j是Apache的一个开源项目,提供了一个灵活的日志...
#测试连接有效性的间隔时间,单位分钟 bonecp.idleConnectionTestPeriod = 60 #连接的空闲存活时间,当连接空闲时间大于该阀值时,清除该连接 bonecp.idleMaxAge = 240 #语句缓存个数,默认是0 bonecp....
2. **0.7.1-rc2版本**:这是BoneCP的一个发布候选版本,rc2意味着它是第二个候选版本,可能在正式发布之前进行最终测试和调整。开发人员可能会选择使用这个版本,因为它在功能稳定性和性能优化方面可能已经相当成熟...
BoneCP 是一个高性能的 JDBC 连接池,它在 Java 应用中被广泛使用,以提高数据库连接的效率和管理。在这个压缩包中,包含了 BoneCP 的所有必需的 JAR 包,以及一个连接示例(demo),帮助开发者快速理解和使用 ...
《BoneCP:一款高效数据库连接池的深度解析》 BoneCP是一款开源的、高性能的Java数据库连接池。在深入理解 BoneCP之前,我们先要明白数据库连接池的基本概念。数据库连接池是在应用服务器启动时创建的,它可以提供...
BoneCP是一款高效的、开源的Java数据库连接池(JDBC Connection Pool)框架,它在性能上优于其他同类连接池,如C3P0和DBCP。本资料提供了使用BoneCP连接Oracle数据库的实例以及所需的jar包,帮助开发者快速理解和...
BoneCP 是一个高效的开源连接池实现,主要用于Java应用程序中数据库连接的管理。它提供了一种高效、可配置的方式来管理和复用数据库连接,从而提高应用程序的性能和稳定性。在标题中提到的 "bonecp-0.8.0.RELEASE....
bonecp数据库连接池jar包0.7.1: bonecp-0.7.1.RELEASE.jar bonecp-provider-0.7.1-rc2.jar bonecp-spring-0.7.1.RELEASE.jar
bonecp-0.8.1-20131105.191813-1.jar bonecp-jdk-compat-0.8.1-20131105.191752-1.jar bonecp-provider-0.8.1-20131105.191842-1.jar slf4j-api-1.7.7.jar slf4j-log4j12-1.7.7.jar
BoneCP是一款高效的数据库连接池,它以其出色的性能和稳定性赢得了开发者们的青睐。相较于其他常见的连接池如c3p0,BoneCP宣称能提供超过25倍的性能提升,这对于高并发、大数据量的Web应用来说尤其重要。在本文中,...
bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar bonecp-0.7.0.jar
骨CP(BoneCP)是一种高性能、轻量级的Java数据库连接池(JDBC Connection Pool)实现,被设计成能够提供比其他同类连接池更高的效率。它由Jeffrey Resnick开发,旨在解决传统连接池在并发处理上的性能问题。在本文...
5. **测试验证**:编写测试用例,确保 BoneCP 能够正常提供数据库连接,Ehcache 的缓存功能也能正常工作。 这样的整合可以大大提高应用的响应速度,同时降低了数据库的负载。在实际项目中,还需要根据业务需求和...