Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-1050

Elements in management.xml are required to be specified in a particular order, for no good reason

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • AMQ 7.6.0.CR1
    • broker-core
    • None

    Description

      The required structure of etc/management.xml configuration file is

      <management-context xmlns="http://activemq.org/schema">
         <authorisation>
            <whitelist>
      [...]
            </whitelist>
            <default-access>
      [...]
            </default-access>
            <role-access>
      [...]
            </role-access>
         </authorisation>
      </management-context>
      

      If I place the <whitelist> element last, as in

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <!--
        ~ Licensed to the Apache Software Foundation (ASF) under one or more
        ~ contributor license agreements. See the NOTICE file distributed with
        ~ this work for additional information regarding copyright ownership.
        ~ The ASF licenses this file to You under the Apache License, Version 2.0
        ~ (the "License"); you may not use this file except in compliance with
        ~ the License. You may obtain a copy of the License at
        ~
        ~     http://www.apache.org/licenses/LICENSE-2.0
        ~
        ~ Unless required by applicable law or agreed to in writing, software
        ~ distributed under the License is distributed on an "AS IS" BASIS,
        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        ~ See the License for the specific language governing permissions and
        ~ limitations under the License.
        -->
      <management-context xmlns="http://activemq.org/schema">
         <!--<connector connector-port="1099"/>-->
         <authorisation>
            <default-access>
               <access method="list*" roles="amq"/>
               <access method="get*" roles="amq"/>
               <access method="is*" roles="amq"/>
               <access method="set*" roles="amq"/>
               <access method="*" roles="amq"/>
            </default-access>
            <role-access>
               <match domain="org.apache.activemq.artemis">
                  <access method="list*" roles="amq"/>
                  <access method="get*" roles="amq"/>
                  <access method="is*" roles="amq"/>
                  <access method="set*" roles="amq"/>
                  <access method="*" roles="amq"/>
               </match>
               <!--example of how to configure a specific object-->
               <!--<match domain="org.apache.activemq.artemis" key="subcomponent=queues">
                  <access method="list*" roles="view,update,amq"/>
                  <access method="get*" roles="view,update,amq"/>
                  <access method="is*" roles="view,update,amq"/>
                  <access method="set*" roles="update,amq"/>
                  <access method="*" roles="amq"/>
               </match>-->
            </role-access>
            <whitelist>
               <entry domain="hawtio"/>
            </whitelist>
         </authorisation>
      </management-context>
      

      the broker does not start and the exception on broker startup I get is

      ../bin/artemis run
      Exception in thread "main" javax.xml.bind.UnmarshalException
       - with linked exception:
      [org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 23; cvc-complex-type.2.4.a: Invalid content was found starting with element 'default-access'. One of '{"http://activemq.org/schema":whitelist}' is expected.]
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:468)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:402)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:371)
              at org.apache.activemq.artemis.dto.XmlUtil.decode(XmlUtil.java:117)
              at org.apache.activemq.artemis.cli.factory.jmx.XmlJmxAclHandler.createJmxAcl(XmlJmxAclHandler.java:34)
              at org.apache.activemq.artemis.cli.factory.jmx.ManagementFactory.createJmxAclConfiguration(ManagementFactory.java:53)
              at org.apache.activemq.artemis.cli.factory.jmx.ManagementFactory.createJmxAclConfiguration(ManagementFactory.java:60)
              at org.apache.activemq.artemis.cli.commands.Configurable.getManagementDTO(Configurable.java:123)
              at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:68)
              at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:149)
              at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:96)
              at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:123)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:129)
              at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:49)
      Caused by: org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 23; cvc-complex-type.2.4.a: Invalid content was found starting with element 'default-access'. One of '{"http://activemq.org/schema":whitelist}' is expected.
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:452)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3230)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1790)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
              at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:86)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:231)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:165)
              at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:400)
              ... 16 mor
      

      Apparently, according to SO, the problem is https://stackoverflow.com/questions/16101488/difference-between-xsdall-and-xsdsequence-in-schema-definition and can be fixed by adding

      iff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/AuthorisationDTO.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/AuthorisationDTO.java
      index dd302467b..8582c8add 100644
      --- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/AuthorisationDTO.java
      +++ b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/AuthorisationDTO.java
      @@ -21,8 +21,10 @@ import javax.xml.bind.annotation.XmlAccessType;
       import javax.xml.bind.annotation.XmlAccessorType;
       import javax.xml.bind.annotation.XmlElementRef;
       import javax.xml.bind.annotation.XmlRootElement;
      +import javax.xml.bind.annotation.XmlType;
       
       @XmlRootElement(name = "authorisation")
      +@XmlType(propOrder={})
       @XmlAccessorType(XmlAccessType.FIELD)
       public class AuthorisationDTO {
      

      Attachments

        Issue Links

          Activity

            People

              rh-ee-ataylor Andy Taylor
              jdanek@redhat.com Jiri Daněk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: