title: Wildfly Security Subsystem: Migrating from Legacy to Elytron, security-domain not found
body: <p>I am trying to migrate a project from using Legacy Security to using Elytron Security.</p>
  
  <p>Until now (Legacy), all that was required for the authentication to work, was to create a Security Domain in Subsystems -> Security with the correct name ("<em>referencesApplicationDomain</em>").</p>
  
  <p>My web.xml:</p>
  
  <pre><code>&lt;web-app ..&gt;
      ...
      &lt;login-config&gt;
          &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
          &lt;realm-name&gt;referencesApplicationDomain&lt;/realm-name&gt;
      &lt;/login-config&gt;
      &lt;security-role&gt;
          &lt;role-name&gt;authenticated&lt;/role-name&gt;
      &lt;/security-role&gt;
      &lt;security-role&gt;
          &lt;role-name&gt;anonymous&lt;/role-name&gt;
      &lt;/security-role&gt;
      &lt;security-constraint&gt;
          &lt;web-resource-collection&gt;
              ....
          &lt;/web-resource-collection&gt;
      &lt;/security-constraint&gt;
          &lt;auth-constraint&gt;
              &lt;role-name&gt;authenticated&lt;/role-name&gt;
          &lt;/auth-constraint&gt;
      &lt;/security-constraint&gt;
  ...
  &lt;/web-app&gt;
  </code></pre>
  
  <p>My jboss-web.xml:</p>
  
  <pre><code>&lt;jboss-web ...&gt;
      &lt;deny-uncovered-http-methods&gt;false&lt;/deny-uncovered-http-methods&gt;
      &lt;context-root&gt;/references&lt;/context-root&gt;
      &lt;security-domain&gt;referencesApplicationDomain&lt;/security-domain&gt;
  &lt;/jboss-web&gt;
  </code></pre>
  
  <p>Of course our idea is to make our application work with Elytron only.</p>
  
  <p>The problem is, however, I don't see where to create the security domain in Elytron.</p>
  
  <p>I followed the <a href="http://docs.wildfly.org/14/WildFly_Elytron_Security.html#set-up-and-configure-authentication-for-applications" rel="nofollow noreferrer">Wildfly Elytron Documentation</a> to create the security-domain as well as the http factory using jboss-cli.</p>
  
  <p>When I check in jboss-cli, I see the security domain was created.</p>
  
  <p>When I try to start the Wildfly server however, I get the following error:</p>
  
  <pre><code>"WFLYCTL0412: Required services that are not installed:" =&gt; [
          "jboss.security.security-domain.referencesApplicationDomain"
      ],
      "WFLYCTL0180: Services with missing/unavailable dependencies" =&gt; [
          "jboss.deployment.unit.\"references-war-1.0.11-SNAPSHOT.war\".component.BranchService.CREATE is missing [jboss.security.security-domain.java:/jaas/referencesApplicationDomain]"
      ]
  </code></pre>
  
  <p>It seems like jboss is trying to find the security-domain in the old security subsystem instead of Elytron. But I don't understand why?</p>
  
  <p>Small remark: I want to use the ApplicaationRealm, to use the users and groups inside the jboss configuration files.</p>