Message: Unexpected element ‘{urn:jboss:domain:keycloak:1.1}subsystem’

  configuration, docker, keycloak, web.xml, wildfly

I am trying to use keycloak in my app. Im running keycloak on docker and using wildfly 20 as application server. I use this scrypt to start keycloak.

version: '3'

services:
  keycloak:
      image: quay.io/keycloak/keycloak:10.0.1
      container_name: keycloak
      environment:
        DB_VENDOR: postgres
        DB_ADDR: host.docker.internal
        DB_USER: keycloak
        DB_PASSWORD: test
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: test
      ports:
        - 8079:8080
        - 8443:8443

Then I added this snippet to my standalone.xml

<subsystem xmlns="urn:jboss:domain:keycloak:1.1">
       <secure-deployment name="pato-ejb.war">
          <realm>pato</realm>
          <auth-server-url>http://localhost:8079/auth</auth-server-url>
          <ssl-required>external</ssl-required>
          <resource>pato</resource>
          <credential name="secret">password</credential>
       </secure-deployment>
    </subsystem>

And security settings to my web.xml

<security-constraint>
        <web-resource-collection>
            <web-resource-name></web-resource-name>
            <description>Protects all resources</description>
            <url-pattern>*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <role-name>admin</role-name>
    </security-role>
    <login-config>
        <auth-method>KEYCLOAK</auth-method>
        <realm-name>pato</realm-name>
    </login-config>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>user/</web-resource-name>
            <url-pattern>/user/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>user</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <role-name>user</role-name>
    </security-role>

And finaly I added keycloak jars to jboss
folder with jars

When I started standalone.bat I immediately got this error

11:41:14,220 ERROR [org.jboss.as.controller] (Controller Boot Thread)

OPVDX001: Validation error in standalone.xml -----------------------------------
|
|  521: </subsystem>
|  522: <subsystem xmlns="urn:jboss:domain:weld:4.0"/>
|  523: <subsystem xmlns="urn:jboss:domain:keycloak:1.1">
|       ^^^^ Unexpected element '{urn:jboss:domain:keycloak:1.1}subsystem'
|
|  524:    <secure-deployment name="pato-ejb.war">
|  525:       <realm>pato</realm>
|  526:       <auth-server-url>http://localhost:8079/auth</auth-server-url>
|
| The primary underlying error message was:
| > ParseError at [row,col]:[523,9]
| > Message: Unexpected element '{urn:jboss:domain:keycloak:1.1}subsystem'
|
|-------------------------------------------------------------------------------

11:41:14,223 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
        at [email protected]//org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:143)
        at [email protected]//org.jboss.as.server.ServerService.boot(ServerService.java:395)
        at [email protected]//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:416)
        at java.base/java.lang.Thread.run(Thread.java:834)

11:41:14,227 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

Source: Docker Questions

LEAVE A COMMENT