Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2011-11-15T18:50:45Z by firepit
FrederikDeBacker
FrederikDeBacker
12 Posts
ACCEPTED ANSWER

Pinned topic OSGi: XADatasource not wrapped?

‏2011-11-04T14:36:17Z |
Hello,

I have registered a datasource like below:

<bean id="derbyXADataSource" class="org.apache.derby.jdbc.EmbeddedXADataSource">
<property name="databaseName" value="memory:dexiaosgipocDB" />
<property name="createDatabase" value="create" />
</bean>

<service ref="derbyXADataSource" interface="javax.sql.XADataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/xadexiaosgipocdb" />
</service-properties>
</service>

I want to use this datasource via JNDI lookup string as recommended in book 'Enterprise OSGi in action':

osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/xadexiaosgipocdb)

This is working in Aries 0.3 since Aries wraps the XADatasource in a normal Datasource (you also see two datasources as registered service). However Websphere CE 3.0.0 doesn't seem to do this: the datasource is only found back when I use the jndi string

osgi:service/javax.sql. XA DataSource/(osgi.jndi.service.name=jdbc/xadexiaosgipocdb)

and not via

osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/xadexiaosgipocdb)

I have seen that this version of websphere CE has version 0.2-incubating for JTA and JPA jars. Might this have something to do with it?

kr,

Frederik.
Updated on 2011-11-15T18:50:45Z at 2011-11-15T18:50:45Z by firepit
  • FrederikDeBacker
    FrederikDeBacker
    12 Posts
    ACCEPTED ANSWER

    Re: OSGi: XADatasource not wrapped?

    ‏2011-11-04T15:07:45Z  in response to FrederikDeBacker
    All,

    After some investigation I noticed that WAS CE 3.0.0 doesn't include the org.apache.aries.transaction.wrappers.jar. This jar is present in the Aries 0.3 distribution and is used to wrap an XADataSource in a 'normal' DataSource. Is there a reason why this is not included?

    kr,

    Frederik.
    • David_Jencks
      David_Jencks
      1 Post
      ACCEPTED ANSWER

      Re: OSGi: XADatasource not wrapped?

      ‏2011-11-04T21:27:28Z  in response to FrederikDeBacker
      Hi,

      The aries datasource/xadatasource stuff is sort of for demo purposes, it doesn't provide connection pooling or transaction recovery. In geronimo you need to deploy one of the tranql wrappers with a geronimo plan to configure your xadatasource.

      I've done some work to make this easier and more osgi friendly in my geronimo sandbox but it is not integrated into geronimo trunk or was ce and may not be anytime soon.
      • FrederikDeBacker
        FrederikDeBacker
        12 Posts
        ACCEPTED ANSWER

        Re: OSGi: XADatasource not wrapped?

        ‏2011-11-07T07:13:46Z  in response to David_Jencks
        Hi David,

        Thanks for the reply! I have tried this also: I deployed the tranql-connector-derby-embed-xa-1.6.rar file together with the geronimo deployment plan below. This creates the database pool (I can verify this via the console). However when I try to lookup the datasource in my persistence.xml file via the jndi name 'jdbc/xadexiaosgipoc', i don't find back that name (see my previous post from 04 november).

        Can you also give some assistance on this?

        thanks a lot,

        Frederik.

        <connection-definition>
        <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>

        <connectiondefinition-instance>
        <name>jdbc/xadexiaosgipocdb</name>
        <jndi-name>jdbc/xadexiaosgipocdb</jndi-name>
        <config-property-setting name="UserName"/>
        <config-property-setting name="Password"/>
        <config-property-setting name="DatabaseName">memory:dexiaosgipocDB</config-property-setting>
        <config-property-setting name="CreateDatabase">true</config-property-setting>
        <connectionmanager>
        <xa-transaction>
        <transaction-caching/>
        </xa-transaction>
        <single-pool>
        <max-size>100</max-size>
        <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
        <select-one-assume-match/>
        </single-pool>
        </connectionmanager>
        </connectiondefinition-instance>
        • FrederikDeBacker
          FrederikDeBacker
          12 Posts
          ACCEPTED ANSWER

          Re: OSGi: XADatasource not wrapped?

          ‏2011-11-07T11:25:02Z  in response to FrederikDeBacker
          Solved, see https://www.ibm.com/developerworks/forums/thread.jspa?threadID=395271&tstart=0
          • firepit
            firepit
            1 Post
            ACCEPTED ANSWER

            Re: OSGi: XADatasource not wrapped?

            ‏2011-11-15T18:50:45Z  in response to FrederikDeBacker
            i cant understand u r coding can u explain more about this thanks
            [url=http://www.patiomarket.com]fire pit[/url]