4 Replies Latest reply on Oct 23, 2018 7:33 AM by Philippe Marschall

    Agroal as Default DataSource

    Philippe Marschall Expert

      We are trying out Agroal and could not yet get it working as a default DataSource.

      We added the extension

      <extension module="org.wildfly.extension.datasources-agroal"/>

      and then replaced the default datasources subsystem configuration with what we believe is the Agroal equivalent

      <subsystem xmlns="urn:jboss:domain:datasources-agroal:1.0">

        <datasource name="ExampleDS" jndi-name="java:jboss/datasources/ExampleDS">

            <connection-factory driver="h2" url="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" username="sa" password="sa">

            </connection-factory>

            <connection-pool max-size="30"/>

        </datasource>

        <drivers>

          <driver name="h2" module="com.h2database.h2" class="org.h2.Driver"/>

        </drivers>

      </subsystem>

      We kept the same JDNI name upon lookup of the data source we get:

      Caused by: javax.naming.NameNotFoundException: DefaultDataSource -- service jboss.naming.context.java.module."transaction-query-timeout-test-0.1.0-SNAPSHOT"."transaction-query-timeout-test-0.1.0-SNAPSHOT".DefaultDataSource

        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)

        at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:239)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)

        at javax.naming.InitialContext.lookup(InitialContext.java:417)

        at javax.naming.InitialContext.lookup(InitialContext.java:417)

        at com.github.marschall.transactionquerytimeouttest.QueryTimeoutBean.getQueryTimeout(QueryTimeoutBean.java:29)

        ... 110 more

      Is there some additional configuration that we missed?