Hello.

I'm trying to configure a XADataSource exposed by a bundle and a
feature. (see the attachment).

The bundle is a single blueprint that creates the PostgreSQL XA
DataSource and exposes it as a service.

I set Aries XA properties to let Aries wrapping my datasource : I hope
this works in my case. At the bundle level,

The service appears like that :
[javax.sql.XADataSource]
------------------------
 aries.xa.name = xa-fifi
 aries.xa.pooling = true
 aries.xa.poolMaxSize = 10
 aries.xa.poolMinSize = 3
 datasource.name = postgresql-fifi
 osgi.jndi.service.name = jdbc/fifi
 osgi.service.blueprint.compname = dsBean
 service.bundleid = 124
 service.id = 210
 service.scope = bundle
  Provided by : Fifi-T26 :: DB (124)
 Used by:
  System Bundle (0)

My feature (see attachment), declares a non-XA DataSource capability,
what is perhaps wrong...
<capability>osgi.service;objectClass=javax.jdbc.DataSource);effective:=active</capability>

Should I declare a double capability with XADataSource ?

But my Camel routes bundle references a jaxa.sql.DataSource service
with the needed jndi name, but fails with this error message.

Unable to start container for blueprint bundle
my-test-26-karaf-2-routes/0.0.1.SNAPSHOT due to unresolved
dependencies 
[(&(osgi.jndi.service.name=jdbc/fifi)(objectClass=javax.sql.DataSource))]

The same pattern works on Red-Hat Fuse with a XADataSource exposed
service and a DataSource reference in the routes bundles, because
Aries TM is wrapping the service to auto-enlist connections in JTA
transactions...

What's wrong here ???
Someone with any experience on transactions ?

Thanks in advance.

Regards.


I expect Aries to wrap ml
<?xml version="1.0" encoding="UTF-8"?>

<blueprint
	xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
	xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
							http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
						http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
							http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd";>

	<cm:property-placeholder
		persistent-id="my_test_26_karaf_s_db"
		update-strategy="reload" />

	<bean
		id="dsBean"
		class="org.postgresql.xa.PGXADataSource">
		<property
			name="serverName"
			value="${my.server-name}" />
		<property
			name="portNumber"
			value="${my.server-port}" />
		<property
			name="databaseName"
			value="${my.database-name}" />
		<property
			name="user"
			value="${my.user-name}" />
		<property
			name="password"
			value="${my.user-password}" />
		<property
			name="applicationName"
			value="${my.application-name}" />
		<property
			name="defaultRowFetchSize"
			value="5" />
	</bean>

	<service
		interface="javax.sql.XADataSource"
		ref="dsBean">
		<service-properties>
			<entry
				key="osgi.jndi.service.name"
				value="jdbc/fifi" />
			<entry
				key="datasource.name"
				value="postgresql-fifi" />
			<entry
				key="aries.xa.name"
				value="xa-fifi" />
           <entry
                key="aries.xa.pooling"
                value="true" />
            <entry
                key="aries.xa.poolMinSize"
                value="${my.pool-initital}" />
            <entry
                key="aries.xa.poolMaxSize"
                value="${my.pool-maximum}" />
 		</service-properties>
	</service>

</blueprint>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; name="my-test-26-karaf-s-db">
    <feature name="my-test-26-karaf-s-db-cfg" description="Fifi-T26 :: DB Data Source - Configuration" version="0.0.1.SNAPSHOT">
        <details>Fifi-T26 :: DB Data Source - Configuration</details>
        <configfile finalname="/etc/my_test_26_karaf_s_db.cfg">mvn:my.tests/my-test-26-karaf-s-db/0.0.1-SNAPSHOT/cfg/configuration</configfile>
    </feature>
    <feature name="my-test-26-karaf-s-db" description="Fifi-T26 :: DB" version="0.0.1.SNAPSHOT">
        <details>Fifi-T26 :: DB Data Source</details>
        <feature version="0.0.1-SNAPSHOT" prerequisite="true">my-test-26-karaf-s-db-cfg</feature>
        <feature version="4.4.1" prerequisite="true">aries-blueprint</feature>
        <bundle>mvn:my.tests/my-test-26-karaf-s-db/0.0.1-SNAPSHOT</bundle>
        <bundle>mvn:org.postgresql/postgresql/42.4.2</bundle>
        <capability>osgi.service;objectClass=javax.jdbc.DataSource);effective:=active</capability>
    </feature>
</features>

Reply via email to