Hi,

I am trying to get the MasterSlave configuration to work properly using JDBC
persistence with C3P0 Connection pool with my Oracle DataSource.

I have a single instance of my client application and two ActiveMQ instances
on different ports.

When I try to start up each of the ActiveMQ instances, the startup fails,
because the ActiveMQ can not get a lock on the database. At this point I
don't even have my client app running.

First the console displays some information during the startup...


INFO  | A checked-out resource is overdue, and will be destroyed:
com.mchange.v2.c3p0.impl.newpooledconnect...@7a4489 |
com.mchange.v2.resourcepool.BasicResourcePool | Timer-0
DEBUG | Preparing to destroy resource:
com.mchange.v2.c3p0.impl.newpooledconnect...@13f136e |
com.mchange.v2.resourcepool.BasicResourcePool |
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1
DEBUG | Preparing to destroy PooledConnection:
com.mchange.v2.c3p0.impl.newpooledconnect...@13f136e |
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool |
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1

....

ERROR | Failed to update database lock: java.sql.SQLException: Closed
Connection | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | ActiveMQ
Cleanup Timer
java.sql.SQLException: Closed Connection
 at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
 at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
 at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
 at
oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:868)
 at
oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:787)
 at
com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:213)
 at
org.apache.activemq.store.jdbc.DefaultDatabaseLocker.keepAlive(DefaultDatabaseLocker.java:159)
 at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.databaseLockKeepAlive(JDBCPersistenceAdapter.java:508)
 at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter$1.run(JDBCPersistenceAdapter.java:203)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
 at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
 at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
 at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
 at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
 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:619)


....


INFO  | No longer able to keep the exclusive lock so giving up being a
master | org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | ActiveMQ
Cleanup Timer
INFO  | ActiveMQ Message Broker (localhost,
ID:4FIL46076-4276-1267705377671-0:0) is shutting down |
org.apache.activemq.broker.BrokerService | ActiveMQ Cleanup Timer


... 

And then the AMQ instance shuts down, as expected from the log messages.

Here is the DataSource and connector configurations I am using:

<bean id="oracle-ds" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
  <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
  <property name="jdbcUrl"
value="jdbc:oracle:thin:@111.111.111.111:1521:abcd"/>
  <property name="idleConnectionTestPeriod" value="100" />
  <property name="maxIdleTime" value="1800"/>
  <property name="minPoolSize" value="13"/>
  <property name="maxPoolSize" value="50"/>
  <property name="unreturnedConnectionTimeout" value="30"/>
  <property name="maxConnectionAge" value="1800"/>
  <property name="numHelperThreads" value="6"/>
  <property name="maxStatements" value="0"/>
                <property name="user" value="username"/>
                <property name="password" value="password"/>                
 </bean>


...

<persistenceAdapter>
    <jdbcPersistenceAdapter dataSource="#oracle-ds" />
</persistenceAdapter>

...

Has anyone succesfully used C3P0 connection pool with Oracle and ActiveMQ? 

Does anyone have any idea why this setup does not work?

Thank you for your help!

-- 
View this message in context: 
http://old.nabble.com/MasterSlave-%7C-Spring-%2B-Camel-%2B-ActiveMQ-%2B-C3P0-%2B-Oracle-tp27780184p27780184.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to