BTM Throws Null Pointer Exception During DB Pool Creation

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

BTM Throws Null Pointer Exception During DB Pool Creation

greenbean
We are running in to random NullPointerException errors during startup of our Spring context.  Starting produces an error around 50 percent of the time.  It looks like BTM is having a problem filling the database pool with connections from Oracle.  However, we don’t have any issues connecting with other applications.  We also have pools for ActiveMQ and a Postgres database.  These pools never have issues.  Do you have any hints as to the cause of this problem?  The problem has been occuring for several months, but seems to have gotten worse recently for some reason.
 
Info:
Bitronix 2.1.3
JDK 6u32
Linux
Oracle 11g
 
    <bean id="oracleDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init"  destroy-method="close">
        <property name="className" value="oracle.jdbc.xa.client.OracleXADataSource" />
        <property name="uniqueName" value="oracle" />
        <property name="minPoolSize" value="10" />
        <property name="maxPoolSize" value="40" />
        <property name="testQuery" value="select 1 from dual" />
        <property name="allowLocalTransactions" value="true" />
        <property name="driverProperties">
            <props>
                <prop key="URL">***</prop>
                <prop key="user">***</prop>
                <prop key="password">***</prop>
            </props>
        </property>
    </bean>
 
 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'afrDataSource' defined in class path resource [context.xml]: Invocation of init method failed; nested exception is bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named oracle
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
        ... 105 more
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named oracle
        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
        ... 121 more
Caused by: java.lang.NullPointerException
        at bitronix.tm.resource.jdbc.JdbcPooledConnection.<init>(JdbcPooledConnection.java:87)
        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.growUntilMinPoolSize(XAPool.java:400)
        at bitronix.tm.resource.common.XAPool.init(XAPool.java:71)
        at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:64)
        at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:101)
        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)
 
 
Reply | Threaded
Open this post in threaded view
|

Re: BTM Throws Null Pointer Exception During DB Pool Creation

Ludovic Orban-2
Hi and sorry for the delay answering back this question.

This looks like yet another Oracle JDBC driver bug to me. The NPE is thrown at this line:

        this.xaResource = xaConnection.getXAResource();

While nothing in the javadoc says that XAConnection.getXAResource() cannot return null, I fail to see how an XAConnection without its XAResource could be controlled by a transaction manager.

I'm afraid the only advice I can give you is to try another version of the Oracle driver, and eventually report that problem to Oracle.

--
Ludovic


On Fri, Aug 17, 2012 at 11:47 PM, Urciolo, Kevin J (IS) <[hidden email]> wrote:
We are running in to random NullPointerException errors during startup of our Spring context.  Starting produces an error around 50 percent of the time.  It looks like BTM is having a problem filling the database pool with connections from Oracle.  However, we don’t have any issues connecting with other applications.  We also have pools for ActiveMQ and a Postgres database.  These pools never have issues.  Do you have any hints as to the cause of this problem?  The problem has been occuring for several months, but seems to have gotten worse recently for some reason.
 
Info:
Bitronix 2.1.3
JDK 6u32
Linux
Oracle 11g
 
    <bean id="oracleDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init"  destroy-method="close">
        <property name="className" value="oracle.jdbc.xa.client.OracleXADataSource" />
        <property name="uniqueName" value="oracle" />
        <property name="minPoolSize" value="10" />
        <property name="maxPoolSize" value="40" />
        <property name="testQuery" value="select 1 from dual" />
        <property name="allowLocalTransactions" value="true" />
        <property name="driverProperties">
            <props>
                <prop key="URL">***</prop>
                <prop key="user">***</prop>
                <prop key="password">***</prop>
            </props>
        </property>
    </bean>
 
 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'afrDataSource' defined in class path resource [context.xml]: Invocation of init method failed; nested exception is bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named oracle
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
        ... 105 more
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named oracle
        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
        ... 121 more
Caused by: java.lang.NullPointerException
        at bitronix.tm.resource.jdbc.JdbcPooledConnection.<init>(JdbcPooledConnection.java:87)
        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.growUntilMinPoolSize(XAPool.java:400)
        at bitronix.tm.resource.common.XAPool.init(XAPool.java:71)
        at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:64)
        at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:101)
        at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)