aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Holly Cummins <>
Subject Re: DataSource and XADataSource services and property
Date Mon, 07 Mar 2011 15:18:40 GMT
Hi Brian, 

Thanks for the response. I've added some comments below:

[cut for length]

> The dataSource blueprint.xml file is meant to be the equivalent of the
> configuration that you would provide to an application server when
> configuring data sources, i.e. this is the way that the data source is
> configured to use a particular jndi name. This name is then copied to 
> data source that the application uses (see below).

My concern is that copying the JNDI name to the data source that the 
application uses doesn't have the intended effect, because the datasource 
can't actually be looked up using that JNDI name. So instead of providing 
the equivalent of the configuration you'd provide to the application 
server, you provide a broken-ish configuration. 

In order to disambiguate between the javax.sql.DataSource and the 
javax.sql.XADataSource which both have the same 
property, a full OSGi service lookup is required:


If we can't use the to infer a usable JNDI name, we 
should perhaps use some other, arbitary, property in the sample. Otherwise 
the samples are misleading. 

> > > 2. In my testing, I found that just registering the
> EmbeddedXADataSource
> >
> > > as a javax.sql.DataSource service and not registering any services 
> > the
> > > XADataSource worked quite well. However, I assume there's a reason 
> > > didn't write the sample this way. :) What's the service under the
> > > XADataSource interface used for? The service isn't referenced in the
> > blog
> > > persistence.xml, so I'm assuming that the blog persistence unit 
> > sees
> > > it.
> This may work fine for the blog sample, but if you have an application 
> needs to participate in XA transactions then you need to provide an
> XADataSource so that the transaction wrappers bundle can detect it and
> create a DataSource capable of enlisting in XA transactions for the
> application to use.

I guess what I was struggling to understand was why an 
EmbeddedXADataSource wasn't able to participate in XA transactions. I 
understand now that - despite its name - the EmbeddedXADataSource isn't 
capable of the full XA support we need and that it needs to be wrapped in 
a fuller featured datasource. That's the piece I was missing. 

I do think we need some improvement in this area. One option is just to 
replace the misleading use of in the sample with 
another property which can be still used as a filter but doesn't suggest 
the datasources can be looked up by friendly JNDI names. An alternative 
(thanks Tim!), if we do want to enable the 'short-form' JNDI names, is 
that we set a property something like '' on the 
javax.sql.XADataSource. When Aries registers the javax.sql.DataSource, it 
could turn the '' into the 
''. This would enable the short-form JNDI lookup 
while avoiding the name clash. 

I'll raise a JIRA either to rewrite the sample or provide support for 
datasource lookups of the form 


with an extra property. 

Do people have a preference between these two options? Or any other 

[cut for length]


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message