Bitronix With Spring Startup When Database Is Down

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bitronix With Spring Startup When Database Is Down

greenbean

We are currently using BTM-2.1.3.  We would like to support starting the associated Spring context when our database is down and have the software connect when the database is available.  However, we get the exception shown below when our software is starting up.

 

We tried setting IgnoreRecoveryFailures(true), however it did not seem to fix the problem.  Should there or can there be a check in the RecoveryException catch shown below to only do the statements in the catch if the ignoreRecoveryFailures is false?

 

From PoolingDataSource.java:

    private void buildXAPool() throws Exception {

        if (pool != null)

            return;

 

        if (log.isDebugEnabled()) { log.debug("building XA pool for " + getUniqueName() + " with " + getMinPoolSize() + " connection(s)"); }

        pool = new XAPool(this, this, xaDataSource);

        boolean builtXaFactory = false;

        if (xaDataSource == null) {

            xaDataSource = (XADataSource) pool.getXAFactory();

            builtXaFactory = true;

        }

        try {

            ResourceRegistrar.register(this);

        } catch (RecoveryException ex) {

            if (builtXaFactory) xaDataSource = null;

            pool = null;

            throw ex;

        }

    }

 

Error Received During Spring Context Creation:

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named testoracle

        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)

        at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:250)

        at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)

        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)

        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)

        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)

        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)

        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)

        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

        ... 189 more

Caused by: bitronix.tm.recovery.RecoveryException: cannot start recovery on a PoolingDataSource containing an XAPool of resource oracle with 0 connection(s) (0 still available)

        at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:288)

        at bitronix.tm.recovery.IncrementalRecoverer.recover(IncrementalRecoverer.java:61)

        at bitronix.tm.resource.ResourceRegistrar.register(ResourceRegistrar.java:87)

        at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:104)

        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)

        ... 200 more

Caused by: java.lang.RuntimeException: XADataSourceWrapper.getXAConnection() - Exception: java.util.concurrent.ExecutionException: java.sql.SQLException: Listener refused the connection with the following error:  ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

 

        at XADataSourceWrapper.getXAConnection(XADataSourceWrapper.java:68)

        at bitronix.tm.resource.jdbc.PoolingDataSource.createPooledConnection(PoolingDataSource.java:341)

        at bitronix.tm.resource.common.XAPool.createPooledObject(XAPool.java:283)

        at bitronix.tm.resource.common.XAPool.grow(XAPool.java:391)

        at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:371)

        at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:123)

        at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:284)

        ... 204 more

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bitronix With Spring Startup When Database Is Down

Ludovic Orban-2
This looks like a bug to me, or more precisely: a case that isn't yet taken into account.

Please open a JIRA at https://jira.codehaus.org/browse/BTM and we'll get it fixed as soon as possible.

Thanks for the report!


On Mon, Apr 29, 2013 at 11:32 PM, Urciolo, Kevin J (IS) <[hidden email]> wrote:

We are currently using BTM-2.1.3.  We would like to support starting the associated Spring context when our database is down and have the software connect when the database is available.  However, we get the exception shown below when our software is starting up.

 

We tried setting IgnoreRecoveryFailures(true), however it did not seem to fix the problem.  Should there or can there be a check in the RecoveryException catch shown below to only do the statements in the catch if the ignoreRecoveryFailures is false?

 

From PoolingDataSource.java:

    private void buildXAPool() throws Exception {

        if (pool != null)

            return;

 

        if (log.isDebugEnabled()) { log.debug("building XA pool for " + getUniqueName() + " with " + getMinPoolSize() + " connection(s)"); }

        pool = new XAPool(this, this, xaDataSource);

        boolean builtXaFactory = false;

        if (xaDataSource == null) {

            xaDataSource = (XADataSource) pool.getXAFactory();

            builtXaFactory = true;

        }

        try {

            ResourceRegistrar.register(this);

        } catch (RecoveryException ex) {

            if (builtXaFactory) xaDataSource = null;

            pool = null;

            throw ex;

        }

    }

 

Error Received During Spring Context Creation:

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named testoracle

        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)

        at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:250)

        at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)

        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)

        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)

        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)

        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)

        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)

        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

        ... 189 more

Caused by: bitronix.tm.recovery.RecoveryException: cannot start recovery on a PoolingDataSource containing an XAPool of resource oracle with 0 connection(s) (0 still available)

        at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:288)

        at bitronix.tm.recovery.IncrementalRecoverer.recover(IncrementalRecoverer.java:61)

        at bitronix.tm.resource.ResourceRegistrar.register(ResourceRegistrar.java:87)

        at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:104)

        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)

        ... 200 more

Caused by: java.lang.RuntimeException: XADataSourceWrapper.getXAConnection() - Exception: java.util.concurrent.ExecutionException: java.sql.SQLException: Listener refused the connection with the following error:  ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

 

        at XADataSourceWrapper.getXAConnection(XADataSourceWrapper.java:68)

        at bitronix.tm.resource.jdbc.PoolingDataSource.createPooledConnection(PoolingDataSource.java:341)

        at bitronix.tm.resource.common.XAPool.createPooledObject(XAPool.java:283)

        at bitronix.tm.resource.common.XAPool.grow(XAPool.java:391)

        at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:371)

        at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:123)

        at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:284)

        ... 204 more


Loading...