I need to have 2 xa-datasources for my thorntail/swarm app but I can't understand where to put relevant informations. It seems from what I read that I need to have a project-default.yml file, for exemple :
swarm:
datasources:
xa-data-sources:
statsDS:
driver-name: postgresql
connection-url: jdbc:postgresql://postgres:5432/stats
user-name: stats
password: stats++
OracleDS:
driver-name: oracle
connection-url: jdbc:oracle:thin:@oracle:1521:XE
user-name: ora
password: ora++
jdbc-drivers:
oracle:
driver-class-name: oracle.jdbc.OracleDriver
xa-datasource-class: oracle.jdbc.xa.client.OracleXADataSource
driver-module-name: com.oracle
postgresql:
driver-class-name: org.postgresql.Driver
xa-datasource-class: org.postgresql.xa.PGXADataSource
driver-module-name: org.postgresql
And some *-ds.xml files as well, and in these *-ds.xml files I find some identical information than in project-default.yml. For exemple, oracle-ds.xml :
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<!-- The datasource is bound into JNDI at this location. We reference this
in META-INF/persistence.xml -->
<xa-datasource
jndi-name="java:jboss/datasources/oracleDS" pool-name="oracle">
<xa-datasource-property name="URL">
jdbc:oracle:thin:@oracle:1521:XE
</xa-datasource-property>
<driver>oracle</driver>
<security>
<user-name>ora</user-name>
<password>ora++</password>
</security>
<validation>
<valid-connection-checker
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker" />
<stale-connection-checker
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker" />
<exception-sorter
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter" />
</validation>
</xa-datasource>
</datasources>
Why the same informations (driver, user, passwd, url) in those 2 files ?
And anyway this conf doesn't work :
2018-09-30 14:07:19,377 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 6) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("xa-data-source" => "statsDS")
]) - failure description: "WFLYCTL0155: 'jndi-name' may not be null"
Just to be complete postgresql-ds.xml :
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<xa-datasource jndi-name="java:jboss/datasources/statsDS"
pool-name="PostgresXADS">
<xa-datasource-property name="URL">
jdbc:postgresql://postgres:5432/stats
</xa-datasource-property>
<driver>postgresql</driver>
<security>
<user-name>stats</user-name>
<password>stats++</password>
</security>
<validation>
<valid-connection-checker
class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker">
</valid-connection-checker>
<exception-sorter
class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter">
</exception-sorter>
</validation>
</xa-datasource>
</datasources>
If I don't use project-default.yml, and only *-ds.xml files, I have :
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oracle"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.data-source.\"jboss.naming.context.java.jboss.datasources.oracleDS\" is missing [jboss.jdbc-driver.oracle]"]
I may precise that I have a module.xml and ojdbcxxx.jar in my resources/modules/com/oracle/main directory.
So how should I do to have my 2 XA-datasources working in my project ? Thanks ...
Finally, no need of *-ds.xml files everything that is in those files could be in project-default.yml. Finally my project-default.yml looks like :
Then take care of having the right modules in your resources directory. And that's all.
Hope it could help some people, because I found the doc a little poor about this.