3

We have an Oracle 11g database, a web service that uses hibernate. We recently switched to BoneCP for connection pooling but there seems to be something wrong and the BoneCP shuts down in the middle of the software startup.

Here is the hibernate.cfg file:

<hibernate-configuration>
<session-factory>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.password">pass</property>
    <property name="hibernate.connection.url">url/property>
    <property name="hibernate.connection.username">user</property>
    <property name="hibernate.default_schema">SYSTEM</property>
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="hibernate.connection.defaultNChar">true</property>
    <property name="hibernate.connection.writedelay">0</property>
    <property name="hbm2ddl.auto">update</property>
    <property name="show_sql">true</property>

    <property name="bonecp.partitionCount">1</property>
    <property name="bonecp.maxConnectionsPerPartition">45</property>
    <property name="bonecp.minConnectionsPerPartition">10</property>
    <property name="bonecp.acquireIncrement">10</property>
    <property name="bonecp.idleConnectionTestPeriodInMinutes">1</property>
    <property name="bonecp.idleMaxAgeInMinutes">10</property>
    <property name="bonecp.idleConnectionTestPeriod">60</property>
    <property name="bonecp.poolAvailabilityThreshold">5</property>
    <property name="bonecp.partitionCount">1</property>
    <property name="bonecp.acquireIncrement">3</property>
    <property name="bonecp.releaseHelperThreads">3</property>
    <property name="bonecp.connectionTestStatement">SELECT 1</property>
    <property name="connection.provider_class">com.jolbox.bonecp.provider.BoneCPConnectionProvider</property>
</session-factory>
</hibernate-configuration> 

In the software's startup, three queries will be executed, but before the third query gets a chance to be executed, the BoneCP seems to be shutting down, with this line in the log file:

SEVERE: [http-thread-pool-8080(5)] INFO com.jolbox.bonecp.BoneCP - Shutting down connection pool...

Here is the relevant stack trace:

org.hibernate.util.JDBCExceptionReporter|_ThreadID=100;_ThreadName=Thread-2;|Attempting to obtain a connection from a pool that has already been shutdown. 
Stack trace of location where pool was shutdown follows:
 java.lang.Thread.getStackTrace(Thread.java:1567)
 com.jolbox.bonecp.BoneCP.captureStackTrace(BoneCP.java:543)
 com.jolbox.bonecp.BoneCP.shutdown(BoneCP.java:159)
 com.jolbox.bonecp.provider.BoneCPConnectionProvider.close(BoneCPConnectionProvider.java:77)
 org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:175)
 org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
 data.ContractManagerUnitOfWork.createSession(ContractManagerUnitOfWork.java:166)
 data.ContractManagerUnitOfWork.<init>(ContractManagerUnitOfWork.java:36)
 data.UnitOfWorkFactory.createContractManagerUnitOfWork(UnitOfWorkFactory.java:10)
 controller.contractManager.ContractController.getCount(ContractController.java:112)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.lang.reflect.Method.invoke(Method.java:601)
 com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
 com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
 com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
 com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
 com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
 com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
 com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
 com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
 com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
 com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
 com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
 com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
 com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
 org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
 org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
 com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
 com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
 com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
 com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
 com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
 com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
 com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
 com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
 com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
 com.sun.grizzly.ContextTask.run(ContextTask.java:71)
 com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
 com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
 java.lang.Thread.run(Thread.java:722)

We are using the bonecp-0.7.1.RELEASE.jar, bonecp-provider-0.7.1.RELEASE.jar and guava-14.0.1.jar.

bbkglb
  • 769
  • 1
  • 7
  • 16

1 Answers1

0

From: com.jolbox.bonecp.provider.BoneCPConnectionProvider.close

this means the layers beneath the pool are explicitly calling shutdown so your problem lies elsewhere.

wwadge
  • 3,506
  • 1
  • 19
  • 28
  • Thanks for your response, could you please explain a bit more? Because the shutdown method of BoneCP isn't called anywhere. In fact the only thing that could be remotely relevant, is the "session.close()" method that is being called after each transaction, which even after removing these method calls, the problem is still there and the application wont startup. – bbkglb Apr 28 '13 at 18:38