Hello Everyone,

I've been observing frequent errors such as
"org.ofbiz.entity.GenericDataSourceException: Unable to esablish a
connection with the database. (Unable to acquire a new connection from the
pool)". While OFBiz restart helps for sometime, but we would like to avoid
frequent restarts.

I'm wondering if someone else has faced same issues or would like to share
their thoughts. Could it be that upgrade to DBCP2 has introduced new bugs?

I'm using OFBiz trunk (revision 1704086) + MySQL v5.6 + MySQL JDBC driver
v5.1.38 + JDK 7. This version uses Apache DBCP2.

entityengine.xml configuration -
- pool-minsize = "2"
- pool-maxsize = "250"
- time-between-eviction-runs-millis="600000" [used to give same errors with
-1]

Below is the stacktrace of associated with one of these errors -

org.ofbiz.entity.GenericDataSourceException: Unable to esablish a
connection with the database. (Unable to acquire a new connection from the
pool). Rolling back transaction.
org.ofbiz.entity.GenericDataSourceException: Unable to esablish a
connection with the database. (Unable to acquire a new connection from the
pool)
    at
org.ofbiz.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:263)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:366)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.jdbc.SQLProcessor.prepareStatement(SQLProcessor.java:350)
~[ofbiz-entity.jar:?]
    at org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:521)
~[ofbiz-entity.jar:?]
    at org.ofbiz.entity.datasource.GenericDAO.select(GenericDAO.java:492)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.datasource.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:80)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.GenericDelegator.findOne(GenericDelegator.java:1580)
[ofbiz-entity.jar:?]
    at com.mycompany.CustomEvents.addToCart(CustomEvents.java:544)
[ofbiz-mycompanyerp.jar:?]
    at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source) ~[?:?]
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_79]
    at
org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java:92)
[ofbiz-webapp.jar:?]
    at
org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java:78)
[ofbiz-webapp.jar:?]
    at
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:759)
[ofbiz-webapp.jar:?]
    at
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476)
[ofbiz-webapp.jar:?]
    at
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:213)
[ofbiz-webapp.jar:?]
    at
org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:88)
[ofbiz-webapp.jar:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
[servlet-api-3.0.jar:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
[servlet-api-3.0.jar:?]
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:324)
[ofbiz-webapp.jar:?]
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
[tomcat-7.0.64-catalina.jar:7.0.64]
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190)
[tomcat-7.0.64-tomcat-coyote.jar:7.0.64]
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
[tomcat-7.0.64-tomcat-coyote.jar:7.0.64]
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
[tomcat-7.0.64-tomcat-coyote.jar:7.0.64]
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[?:1.7.0_79]
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[?:1.7.0_79]
    at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-7.0.64-tomcat-coyote.jar:7.0.64]
    at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]
Caused by: java.sql.SQLException: Unable to acquire a new connection from
the pool
    at
org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:130)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:60)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.apache.commons.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:82)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.ofbiz.entity.connection.DebugManagedDataSource.getConnection(DebugManagedDataSource.java:52)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:63)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
~[ofbiz-geronimo.jar:?]
    at
org.ofbiz.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:260)
~[ofbiz-entity.jar:?]
    ... 38 more
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
    at
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:449)
~[commons-pool2-2.3.jar:2.3]
    at
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
~[commons-pool2-2.3.jar:2.3]
    at
org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:127)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:60)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.apache.commons.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:82)
~[commons-dbcp2-2.1.jar:2.1]
    at
org.ofbiz.entity.connection.DebugManagedDataSource.getConnection(DebugManagedDataSource.java:52)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:63)
~[ofbiz-entity.jar:?]
    at
org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
~[ofbiz-geronimo.jar:?]
    at
org.ofbiz.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:260)
~[ofbiz-entity.jar:?]
    ... 38 more

--
Vyom

Reply via email to