Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11221

Agroal datasource cannot be used as DefaultDataSource without connector subsystem

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 14.0.0.Final
    • Agroal, EE, JCA
    • None
    • Hide
      1. remove datasources subsystem
      2. add agroal subsystem and define ExampleDS datasource
        <extension module="org.wildfly.extension.datasources-agroal"/>
        ...
        <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>
        
      3. Deploy application that injects DefaultDataSource
        @Resource(lookup="java:comp/DefaultDataSource")
        DataSource myDS;
        
      Show
      remove datasources subsystem add agroal subsystem and define ExampleDS datasource <extension module= "org.wildfly.extension.datasources-agroal" /> ... <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> Deploy application that injects DefaultDataSource @Resource(lookup= "java:comp/DefaultDataSource" ) DataSource myDS;
    • Workaround Exists
    • Hide

      Define empty datasources subsystem. datasources subsytem is currently responsible for DefaultDatasource bindind.

      <subsystem xmlns="urn:jboss:domain:datasources:5.0">
      </subsystem>
      
      Show
      Define empty datasources subsystem. datasources subsytem is currently responsible for DefaultDatasource bindind. <subsystem xmlns= "urn:jboss:domain:datasources:5.0" > </subsystem>

    Description

      If datasources subsystem is removed and Example datasource is created in datasources-agroal subsystem it is expected that Example datasource (java:jboss/datasources/ExampleDS) is bound to java:comp/DefaultDataSource, but it is not.

      12:33:17,605 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "testwebapplication.war")]) - failure description: {
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.testwebapplication.testwebapplication.DefaultDataSource"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.testwebapplication.testwebapplication.env.\"org.jboss.qa.msimka.testwebapp.TestBean\".myDS is missing [jboss.naming.context.java.module.testwebapplication.testwebapplication.DefaultDataSource]"]
      }
      

      JNDI of datasource that should be bound to default datasource can be defined in ee subsystem

      Datasources subsystem is currently responsible for DefaultDatasource binding.

      Attachments

        Activity

          People

            smaestri@redhat.com Stefano Maestri
            msimka@redhat.com Martin Simka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: