Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

XA datasource as a Galleon layer

28 views
Skip to first unread message

Mario Gotovac

unread,
Apr 23, 2025, 5:38:56 AMApr 23
to WildFly
Hi all,

I have a XA datasource I would like to set up as a Galleon layer. The problem is how to correctly define properties for the connection? I cannot find any example of it anywhere.

My layer-spec.xml looks like this:
<?xml version="1.0" ?>
<layer-spec xmlns="urn:jboss:galleon:layer-spec:1.0" name="myapp-datasource">

  <dependencies>
    <layer name="pqsql-driver"/>
  </dependencies>

  <feature spec="subsystem.datasources.xa-data-source">
    <param name="xa-data-source" value="myds"/>
    <param name="jndi-name" value="java:/jdbc/myds"/>
    <param name="xa-datasource-class" value="org.postgresql.xa.PGXADataSource"/>
    <param name="exception-sorter-class-name" value="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
    <param name="valid-connection-checker-class-name" value="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
    <param name="statistics-enabled" value="true"/>
    <param name="validate-on-match" value="false"/>
    <param name="xa-resource-timeout" value="60"/>
    <param name="min-pool-size" value="0"/>
    <param name="max-pool-size" value="64"/>
    <param name="flush-strategy" value="EntirePool"/>
    <param name="user-name" value="${env.DB_USER}"/>
    <param name="password" value="${env.DB_PASSWORD}"/>
    <param name="background-validation" value="true"/>
    <param name="background-validation-millis" value="30000"/>
    <param name="blocking-timeout-wait-millis" value="1000"/>
    <param name="idle-timeout-minutes" value="1"/>
    <param name="allocation-retry" value="5"/>
    <param name="allocation-retry-wait-millis" value="200"/>
  </feature>

  <feature spec="subsystem.datasources.xa-data-source.xa-datasource-properties">
    <param name="xa-data-source" value="myds"/>

    <feature spec="xa-data-source-property">
      <param name="name" value="ServerName"/>
      <param name="value" value="${env.DB_HOST:localhost}"/>
    </feature>

    <feature spec="xa-data-source-property">
      <param name="name" value="DatabaseName"/>
      <param name="value" value="${env.DB_NAME:app_db}"/>
    </feature>

    <feature spec="xa-data-source-property">
      <param name="name" value="PortNumber"/>
      <param name="value" value="${env.DB_PORT:5432}"/>
    </feature>
  </feature>
</layer-spec>

Even if I replace xa-data-source-property with subsystem.datasources.xa-data-source.xa-data-source-property or subsystem.datasources.xa-data-source.xa-datasource-properties.xa-data-source-property I get the same exception when building the feature pack:
org.jboss.galleon.ProvisioningDescriptionException: Non-nillable parameter xa-datasource-properties of {wildfly-ee@maven(org.jboss.universe:community-universe)}subsystem.datasources.xa-data-source.xa-datasource-properties has not been initialized

The same happens when those properties are nested in the subsystem.datasources.xa-data-source feature.

Any idea how to properly define them?

Thanks!
Mario

Jean Francois Denise

unread,
Apr 23, 2025, 7:53:48 AMApr 23
to Mario Gotovac, WildFly
Hi Mario,
I fixed the layer. It was galleon syntax issue. I made 2 additional changes:
* Add the driver to the xa-data-source
* Add the dependency on the datasources layer
Then correct the properties syntax. Here it is:

<layer-spec xmlns="urn:jboss:galleon:layer-spec:2.0" name="postgresql-datasource">
  <dependencies>
    <!-- to enforce that the datasources subsystem is provisioned -->
    <layer name="datasources"/>

    <layer name="pqsql-driver"/>
  </dependencies>
<feature spec="subsystem.datasources.xa-data-source">
    <param name="xa-data-source" value="myds"/>
    <param name="jndi-name" value="java:/jdbc/myds"/>
    <param name="xa-datasource-class" value="org.postgresql.xa.PGXADataSource"/>
    <param name="exception-sorter-class-name" value="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
    <param name="valid-connection-checker-class-name" value="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
    <param name="statistics-enabled" value="true"/>
    <param name="validate-on-match" value="false"/>
    <param name="xa-resource-timeout" value="60"/>
    <param name="min-pool-size" value="0"/>
    <param name="max-pool-size" value="64"/>
    <param name="flush-strategy" value="EntirePool"/>
    <param name="user-name" value="${env.DB_USER}"/>
    <param name="password" value="${env.DB_PASSWORD}"/>
    <param name="background-validation" value="true"/>
    <param name="background-validation-millis" value="30000"/>
    <param name="blocking-timeout-wait-millis" value="1000"/>
    <param name="idle-timeout-minutes" value="1"/>
    <param name="allocation-retry" value="5"/>
    <param name="allocation-retry-wait-millis" value="200"/>
    <!-- this one is required -->
    <param name="driver-name" value="pqsql-driver"/>

  </feature>
  <feature spec="subsystem.datasources.xa-data-source.xa-datasource-properties">
    <param name="xa-data-source" value="myds"/>
    <param name="xa-datasource-properties" value="ServerName"/>

    <param name="value" value="${env.DB_HOST:localhost}"/>
  </feature>
  <feature spec="subsystem.datasources.xa-data-source.xa-datasource-properties">
    <param name="xa-data-source" value="myds"/>
    <param name="xa-datasource-properties" value="DatabaseName"/>

    <param name="value" value="${env.DB_NAME:app_db}"/>
  </feature>
  <feature spec="subsystem.datasources.xa-data-source.xa-datasource-properties">
    <param name="xa-data-source" value="myds"/>
    <param name="xa-datasource-properties" value="PortNumber"/>

    <param name="value" value="${env.DB_PORT:5432}"/>
  </feature>
</layer-spec>

Regards.
JF

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wildfly/5372e27a-db80-4396-b152-998896336b96n%40googlegroups.com.

Mario Gotovac

unread,
Apr 23, 2025, 8:40:48 AMApr 23
to WildFly
Thank you very much, Jean Francois! It works now!

Regards,
Mario

Jean Francois Denise

unread,
Apr 24, 2025, 2:33:30 AMApr 24
to Mario Gotovac, WildFly
Hi Mario,
your need seems quite generic.
I am wondering if we should evolve the WildFly Datasources Galleon feature-pack (that contains postgresql, mysql, mariadb, ...and more datasources) with xa-datasources.
What do you think? If this feature-pack would have contained a layer for postgresql xa-datasource, would it have been usable in your case?
If you are interested to contribute, we can syncup. Perhaps the first thing to do would be to log an issue in: https://github.com/wildfly-extras/wildfly-datasources-galleon-pack/issues
Thank-you.
JF


Mario Gotovac

unread,
Apr 24, 2025, 8:43:58 AMApr 24
to WildFly
XA datasource in this pack would be very useful and I would be glad to contribute. I created an issue here: https://github.com/wildfly-extras/wildfly-datasources-galleon-pack/issues/352

Regards,
Mario

Jean Francois Denise

unread,
Apr 24, 2025, 8:53:54 AMApr 24
to Mario Gotovac, WildFly
That is great news. Thank-you Marco, I would suggest that you give a look to the postgresql datasource layer and perhaps introduce a new one for XA. I can help you once you have opened an initial (perhaps draft?) PR.
JF

Reply all
Reply to author
Forward
0 new messages