1 Reply Latest reply on Nov 11, 2012 4:55 PM by Nicklas Karlsson

    Does the xa-datasource-class element actually do anything?

    Tom Anderson Newbie

      I am setting up an application with a JDBC driver packaged as a module. A simple example of this is at https://bitbucket.org/twic/drivermodule. Here is the datasources subsystem from standalone.xml:


      <subsystem xmlns="urn:jboss:domain:datasources:1.0">
              <datasource jndi-name="java:/jdbc/demoDS" pool-name="demoDS" enabled="true" use-java-context="true">
                      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker" />
                      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter" />
                  <driver name="h2" module="com.h2database.h2">
                  <driver name="pg" module="org.postgresql.jdbc">


      And here is the module.xml for the driver:


      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.1" name="org.postgresql.jdbc">
              <resource-root path="postgresql-9.1-901-1.jdbc4.jar"/>
              <module name="javax.api" />
              <module name="javax.transaction.api" />


      The good news is that this works fine. My application starts, and connects to the database.


      As an experiment, i changed the content of the xa-datasource-class element in the PostgreSQL driver definition to be nonsense.


      My application still starts, and connects to the database.


      I removed the xa-datasource-class element altogether; the driver element was then empty.


      My application still starts, and connects to the database.


      What is going on? Does JBoss actually look at the xa-datasource-class element at all? How is it determining the driver or datasource class?


      I haven't set the services attribute on my module definition, and according to the module descriptor documentation at https://docs.jboss.org/author/display/MODULES/Module+descriptor, that means that no services defined in the JARs should be exported. So, if that is correct, JBoss can't be determining the driver based on the java.sql.Driver service definition.


      Again, what is going on?