使用 java/Spring/Ibatis sqlserver 是数据库和数据源org.apache.commons.dbcp.BasicDataSource
以下是源对象
<bean id="wssModelDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="net.sourceforge.jtds.jdbcx.JtdsDataSource"/>
<property name="url" value="com.wss.jdbc.ConnectionUrl=jdbc:jtds:sqlserver://x-x2/x_control_QA;appName=wss;sendStringParametersAsUnicode=false;loginTimeout=20;socketTimeout=180"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx"/>
<property name="maxActive" value="10"/>
<property name="maxWait" value="10000"/>
</bean>
在日志文件中,我们发现了以下异常。
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object]
堆栈跟踪如下所示
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, general error
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:118)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy.invoke(TransactionAwareDataSourceProxy.java:210)
at .prepareStatement(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:494)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:176)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 196 more
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1112)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
... 204 more
2012-10-15 04:29:57,258 [Thread-2] INFO [ConnectionManagerImpl.java:58] : user[] Stopping managed instances...
2012-10-15 04:29:57,444 [http-bio-8000-exec-81187] INFO [LoggingInterceptor.java:42] : user[] uri[/wss/security/login_submit.html] took[6.612] seconds
2012-10-15 04:29:57,451 [http-bio-8000-exec-81182] ERROR [LoginSubmitAction.java:121] : user[] Exception logging in[
--- The error occurred in ibatis/control_core.xml.
--- The error occurred while executing query.
我正在尝试使用 Jmeter http 登录请求重现此错误,并将用户凭据作为参数,这让我成功登录,从而从控制器调用 DAO 层。
但问题是我已经尝试使用 3 个 Jmeter 实例永久循环 100 个线程,但它没有重现该问题? 任何快速的想法如何重现问题?
我使用 Jmeter 重现了此错误 我创建了httprequest请求登录参数并启动了5个JMeter实例。 并最终能够重现此问题。