Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-20434

[GSS](7.3.z) Unable to remove the default datasource binding from the ee subsystem

XMLWordPrintable

    • False
    • False
    • +
    • Undefined
    • Hide

      Workaround, specify a default binding for the datasource such that the datasource is defined in the datasources subsystem:

               <default-bindings datasource="java:jboss/datasources/MyDataSource" /> 

         

      Show
      Workaround, specify a default binding for the datasource such that the datasource is defined in the datasources subsystem:         < default -bindings datasource= "java:jboss/datasources/MyDataSource" />    
    • Hide

      Remove the datasource from the ee subsystem default bindings such that it is:

               <default-bindings context-service="java:jboss/ee/concurrency/context/default" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/> 

         Deploy reproducer2.war and start JBoss

      ------

      Add a 2nd datasource to make sure the correct datasource is used:

                      <datasource jndi-name="java:jboss/datasources/AppDS" pool-name="AppDS" enabled="true" use-java-context="true">
                          <connection-url>jdbc:h2:mem:test2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                          <driver>h2</driver>
                          <security>
                              <user-name>sa</user-name>
                              <password>sa</password>
                          </security>
                      </datasource> 
      Show
      Remove the datasource from the ee subsystem default bindings such that it is:         < default -bindings context-service= "java:jboss/ee/concurrency/context/ default " managed-executor-service= "java:jboss/ee/concurrency/executor/ default " managed-scheduled-executor-service= "java:jboss/ee/concurrency/scheduler/ default " managed-thread-factory= "java:jboss/ee/concurrency/factory/ default " />    Deploy reproducer2.war and start JBoss ------ Add a 2nd datasource to make sure the correct datasource is used:                 <datasource jndi-name= "java:jboss/datasources/AppDS" pool-name= "AppDS" enabled= " true " use-java-context= " true " >                     <connection-url>jdbc:h2:mem:test2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>                     <driver>h2</driver>                     <security>                         <user-name>sa</user-name>                         <password>sa</password>                     </security>                 </datasource>

      EAP 7.2+ is creating a dependency on the DefaultDataSource when it should not.

      If the default datasource is removed from the ee subsystem and an application is deployed with a class that has @Resource specifying a name to inject which is not linked to the default datasource, it should NOT fail with a missing dependency.

      This was found with a Spring application, where Spring configuration is defining java:comp/env/dataSource to link to the real datasource.  In EAP 7.1 the application deployed with no issue, in EAP 7.2+ JBoss is failing the deployment due to the datasource=... being removed from the default bindings in the ee subsystem.

       

        @Resource(name = "dataSource")
        private DataSource dataSource; 

       

       18:08:15,547 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "reproducer2.war")]) - failure description: {
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.reproducer2.reproducer2.DefaultDataSource"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.reproducer2.reproducer2.env.non-existant is missing [jboss.naming.context.java.module.reproducer2.reproducer2.DefaultDataSource]"]
      }

        1. reproducer2.war
          2 kB
        2. standalone.xml
          28 kB
        3. reproducer-spring2.war
          3.92 MB
        4. reproducer-spring.war
          3.92 MB
        5. jbeap-20434.btm
          3 kB

              rhn-engineering-lgao Lin Gao
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: