0 Replies Latest reply on Jan 9, 2017 4:25 PM by Joe Strathern

    Wildfly : Deleting a Datasource and Security Domain with a Management Composite Operation

    Joe Strathern Newbie

      Hello Community,

      I have a Data Source and Security Domain with the following format in standalone.xml:

      <datasource jndi-name="java:/MyDS" pool-name="MyDS" enabled="true">
           <connection-url>...</connection-url>
           <driver>...</driver>
           ...
           <security>
                <security-domain>MyDSSecurityDomain</security-domain>
           </security>
           ...
      </datasource>
      ...
      <security-domain name="MyDSSecurityDomain" cache-type="default">
           ...
      </security-domain>
      

      Using past versions of JBoss, i have always successfully deleted this datasource and security domain with the following management composite operation:

      {
          "operation-headers" => {"allow-resource-service-restart" => true},
          "operation" => "composite",
          "address" => [],
          "steps" => [
              {
                  "operation" => "disable",
                  "address" => [
                      ("subsystem" => "datasources"),
                      ("data-source" => "MyDS")
                  ]
              },
              {
                  "operation" => "remove",
                  "address" => [
                      ("subsystem" => "security"),
                      ("security-domain" => "MyDSSecurityDomain")
                  ]
              },
              {
                  "operation" => "remove",
                  "address" => [
                      ("subsystem" => "datasources"),
                      ("data-source" => "MyDS")
                  ]
              }
          ]
      }
      

      However, I have recently adopted Wildfly 10.1.Final, and this operation is no longer working. In fact, when executed, it leads to the following error:

      {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-3" => "WFLYCTL0171: Removing services has lead to unsatisfied dependencies: Service jboss.security.security-domain.MyDSSecurityDomain was depended upon by service jboss.data-source-config.MyDS"}}

      The result is the same if i switch the order of Data Source and Security Domain Deletion.

      If my Wildfly server starts with MyDS Data Source already disabled, there is no errors deleting both the Data Source and Security Domain. However when the disabling occurs within the same composite operation, or even a separate operation executed right beforehand, the error occurs.

      It appears the Data Source is not officially disabled until a server reload, which i'd like to avoid. However, if the same operations are placed within a single CLI batch, there is no such issue.

      I have also noticed that enabling/disable a data source is deprecated for future release, though i cannot find the recommended replacement for this.

       

      Does anyone know of the recommended way to leverage the Wildfly Native Management API to delete a Data Source and Security Domain in a single Composite Operation?

       

      Thanks,