Atomikos Forum

Upgrading from 3.2.3 to 3.3

Hi I am trying to upgrade from 3.2.3 to 3.3 and I would like to use the new com.atomikos.jdbc.AtomikosDataSourceBean but I am having a trouble using it with embedded Derby (10.3.1000004.561794).

When using with derby, the AtomikosDataSourceBean doesn't seem to be able to create the derby DB on the fly if one doesn't exist while the old SimpleDataSourceBean works fine. Following are the configurations for each.
<bean id="localDatasource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close">
    <property name="uniqueResourceName" value="localDB" />
    <property name="xaDataSourceClassName" value="org.apache.derby.jdbc.EmbeddedXADataSource40" />
    <property name="xaDataSourceProperties"    value="databaseName=localDB;createDatabase=create" />
</bean>

<bean id="localDatasource" class="com.atomikos.jdbc.SimpleDataSourceBean" init-method="init" destroy-method="close">
    <property name="uniqueResourceName" value="com.gvp.rpt.localDB" />
    <property name="uniqueResourceName" value="localDB" />
    <property name="xaDataSourceClassName" value="org.apache.derby.jdbc.EmbeddedXADataSource40" />
    <property name="xaProperties" value="databaseName=localDB;createDatabase=create" />
    <property name="maxPoolSize" value="1" />
</bean>

The exception when using the AtomikosDataSourceBean
Caused by: com.atomikos.jdbc.AtomikosSQLException: cannot initialize AtomikosDataSourceBean: XAConnectionFactory: failed to create pooled connection
    at com.atomikos.jdbc.AbstractDataSourceBean.init(AbstractDataSourceBean.java:259)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1412)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1373)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
    ... 29 more
Caused by: com.atomikos.icatch.SysException: XAConnectionFactory: failed to create pooled connection
    at com.atomikos.jdbc.AtomikosXAConnectionFactory.createPooledConnection(AtomikosXAConnectionFactory.java:70)
    at com.atomikos.datasource.pool.ConnectionPool.init(ConnectionPool.java:73)
    at com.atomikos.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:61)
    at com.atomikos.jdbc.AbstractDataSourceBean.init(AbstractDataSourceBean.java:254)
    ... 36 more
Bluefox Send private email
Saturday, May 17, 2008
 
 
I also noticed that no matter what number of maxPoolSize I set for the com.atomikos.jdbc.AtomikosDataSourceBean. I always see this message in the log. "cannot grow pool as it reached max size: N" Where N is the maximum number I specified.

To make sure that both the min and max are both set correctly, I use these settings for the Spring Bean.
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="1000" />

Then when I run my test case, I was able to find
08-05-17 17:56:33,200 [main] ConnectionPool: cannot grow pool as it reached max size: 1000
in the log. Although the test case seems to pass without any error despite what the maxPoolSize is set to (I've tried 1, 10, 50, 1000, all of them passes, the only difference in the log is that the max value changes in the log).
Bluefox Send private email
Sunday, May 18, 2008
 
 
Reply to my first post, turns out the property parsing in SimpleDataSourceBean and AtomikosDataSourceBean are a little bit different. I changed the xaProperties element from
<property name="xaProperties" value="databaseName=localDB;createDatabase=create" />

to

<property name="xaProperties">
    <props>
        <prop key="databaseName">localDB</prop>
        <prop key="createDatabase">create</prop>
    </props>
</property>

and everything is working fine now =)

P.S. I'm still unable to determine if the dynamic scaling of the pooled connection is working correctly as the cannot grow pool messages are still in the log file.
Bluefox Send private email
Monday, May 19, 2008
 
 
Hi,

Can you please give more details about your test ?

You should see the 'cannot grow pool' message in the logs only if you've acquired maxPoolSize connections from the pool in one go. At that time, the pool will block a configurable amount of time (defaults to 30s) for a connection to be released or fail by throwing an exception.

Could it be that your test opens X or more connections in parallel, X being the maxPoolSize value ?

Ludovic
Ludovic Orban Send private email
Monday, May 19, 2008
 
 
After some code investigation, it turns out that this debug log is a bit misleading as it can appear in two situations:

 - when the pool is empty and reached its maximum size
 - when the pool is not empty

Obviously, you see this log because your code runs in the second case. This message should not be logged in that situation.

This is completely harmless but nevertheless we will fix this for the next release as it may confuse other people.

Thanks for the report.
Ludovic
Ludovic Orban Send private email
Friday, May 23, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics