Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2696

management audit settings: syslog protocol is lowercase while uppercase is expected

    XMLWordPrintable

Details

    • Hide

      clean install using domain mode.

      batch

      /host=master/core-service=management/access=audit/syslog-handler=mysyslog:add(formatter=json-formatter)
      /host=master/core-service=management/access=audit/syslog-handler=mysyslog/protocol=udp:add(host=localhost,port=514)
      

      run-batch

      /host=master/core-service=management/access=audit/logger=audit-log/handler=mysyslog:add()
      

      and subsequently try to start an instance. This generates:

      17:30:25,066 ERROR [org.jboss.as.controller.management-operation] (server-registration-threads - 1) JBAS014612: Operation ("register-server") failed - address: ([]): java.lang.IllegalArgumentException: No enum const class org.jboss.as.controller.audit.SyslogAuditLogHandler$Transport.udp
      	at java.lang.Enum.valueOf(Enum.java:214) [rt.jar:1.6.0_24]
      	at org.jboss.as.controller.audit.SyslogAuditLogHandler$Transport.valueOf(SyslogAuditLogHandler.java:315) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.domain.management.audit.SyslogAuditLogProtocolResourceDefinition.createProtocolAddOperation(SyslogAuditLogProtocolResourceDefinition.java:128) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.domain.management.audit.SyslogAuditLogProtocolResourceDefinition.createServerAddOperations(SyslogAuditLogProtocolResourceDefinition.java:107) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.domain.management.audit.SyslogAuditLogHandlerResourceDefinition.createServerAddOperations(SyslogAuditLogHandlerResourceDefinition.java:105) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.host.controller.ManagedServerOperationsFactory.addAuditLog(ManagedServerOperationsFactory.java:444)
      	at org.jboss.as.host.controller.ManagedServerOperationsFactory.getBootUpdates(ManagedServerOperationsFactory.java:227)
      	at org.jboss.as.host.controller.ManagedServerOperationsFactory.createBootUpdates(ManagedServerOperationsFactory.java:153)
      	at org.jboss.as.host.controller.mgmt.ServerToHostProtocolHandler$ServerRegistrationStepHandler.execute(ServerToHostProtocolHandler.java:219)
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:607) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:485) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:282) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:277) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.controller.ModelControllerImpl.executeReadOnlyOperation(ModelControllerImpl.java:164) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.controller.AbstractControllerService.executeReadOnlyOperation(AbstractControllerService.java:303) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.host.controller.DomainModelControllerService.access$700(DomainModelControllerService.java:140)
      	at org.jboss.as.host.controller.DomainModelControllerService$3.joinActiveOperation(DomainModelControllerService.java:515)
      	at org.jboss.as.host.controller.mgmt.ServerToHostProtocolHandler$ServerRegistrationRequestHandler$1.execute(ServerToHostProtocolHandler.java:180)
      	at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:283) [jboss-as-protocol-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:504) [jboss-as-protocol-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_24]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_24]
      	at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
      	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1]
      

      The issue is simple:

      package org.jboss.as.domain.management.audit;
      
      public abstract class SyslogAuditLogProtocolResourceDefinition extends SimpleResourceDefinition {
      ...
      
          public static ModelNode createProtocolAddOperation(final PathAddress protocolAddress, final ModelNode protocol){
              ModelNode protocolAdd = Util.createAddOperation(protocolAddress);
              protocolAdd.get(HOST.getName()).set(protocol.get(HOST.getName()));
              protocolAdd.get(PORT.getName()).set(protocol.get(PORT.getName()));
      
              SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue());
      

      with:

      protocolAddress = (org.jboss.as.controller.PathAddress) [
          ("core-service" => "management"),
          ("access" => "audit"),
          ("syslog-handler" => "mysyslog"),
          ("protocol" => "udp")
      ]
      

      so "udp" is used... but the enum:

          public enum Transport {
              UDP,
              TCP,
              TLS
          }
      

      has an uppercase UDP.

      The same issue happens in

       public static void createServerAddOperations(final List<ModelNode> addOps, final PathAddress protocolAddress, final ModelNode protocol) {
              addOps.add(createProtocolAddOperation(protocolAddress, protocol));
      
              final SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue());
      

      Solution: make uppercase:

      SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue().toUpperCase());
      
      Show
      clean install using domain mode. batch /host=master/core-service=management/access=audit/syslog-handler=mysyslog:add(formatter=json-formatter) /host=master/core-service=management/access=audit/syslog-handler=mysyslog/protocol=udp:add(host=localhost,port=514) run-batch /host=master/core-service=management/access=audit/logger=audit-log/handler=mysyslog:add() and subsequently try to start an instance. This generates: 17:30:25,066 ERROR [org.jboss.as.controller.management-operation] (server-registration-threads - 1) JBAS014612: Operation ("register-server") failed - address: ([]): java.lang.IllegalArgumentException: No enum const class org.jboss.as.controller.audit.SyslogAuditLogHandler$Transport.udp at java.lang.Enum.valueOf(Enum.java:214) [rt.jar:1.6.0_24] at org.jboss.as.controller.audit.SyslogAuditLogHandler$Transport.valueOf(SyslogAuditLogHandler.java:315) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.domain.management.audit.SyslogAuditLogProtocolResourceDefinition.createProtocolAddOperation(SyslogAuditLogProtocolResourceDefinition.java:128) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.domain.management.audit.SyslogAuditLogProtocolResourceDefinition.createServerAddOperations(SyslogAuditLogProtocolResourceDefinition.java:107) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.domain.management.audit.SyslogAuditLogHandlerResourceDefinition.createServerAddOperations(SyslogAuditLogHandlerResourceDefinition.java:105) [jboss-as-domain-management-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.host.controller.ManagedServerOperationsFactory.addAuditLog(ManagedServerOperationsFactory.java:444) at org.jboss.as.host.controller.ManagedServerOperationsFactory.getBootUpdates(ManagedServerOperationsFactory.java:227) at org.jboss.as.host.controller.ManagedServerOperationsFactory.createBootUpdates(ManagedServerOperationsFactory.java:153) at org.jboss.as.host.controller.mgmt.ServerToHostProtocolHandler$ServerRegistrationStepHandler.execute(ServerToHostProtocolHandler.java:219) at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:607) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:485) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:282) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:277) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.controller.ModelControllerImpl.executeReadOnlyOperation(ModelControllerImpl.java:164) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.controller.AbstractControllerService.executeReadOnlyOperation(AbstractControllerService.java:303) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.host.controller.DomainModelControllerService.access$700(DomainModelControllerService.java:140) at org.jboss.as.host.controller.DomainModelControllerService$3.joinActiveOperation(DomainModelControllerService.java:515) at org.jboss.as.host.controller.mgmt.ServerToHostProtocolHandler$ServerRegistrationRequestHandler$1.execute(ServerToHostProtocolHandler.java:180) at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:283) [jboss-as-protocol-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:504) [jboss-as-protocol-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_24] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_24] at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1] The issue is simple: package org.jboss.as.domain.management.audit; public abstract class SyslogAuditLogProtocolResourceDefinition extends SimpleResourceDefinition { ... public static ModelNode createProtocolAddOperation( final PathAddress protocolAddress, final ModelNode protocol){ ModelNode protocolAdd = Util.createAddOperation(protocolAddress); protocolAdd.get(HOST.getName()).set(protocol.get(HOST.getName())); protocolAdd.get(PORT.getName()).set(protocol.get(PORT.getName())); SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue()); with: protocolAddress = (org.jboss.as.controller.PathAddress) [ ("core-service" => "management"), ("access" => "audit"), ("syslog-handler" => "mysyslog"), ("protocol" => "udp") ] so "udp" is used... but the enum: public enum Transport { UDP, TCP, TLS } has an uppercase UDP. The same issue happens in public static void createServerAddOperations( final List<ModelNode> addOps, final PathAddress protocolAddress, final ModelNode protocol) { addOps.add(createProtocolAddOperation(protocolAddress, protocol)); final SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue()); Solution: make uppercase: SyslogAuditLogHandler.Transport.valueOf(protocolAddress.getLastElement().getValue().toUpperCase());
    • Low

    Description

      Add a syslog handler to the audit settings of the management service of the domain controller, then start an instance. It fails to start with:

      JBAS014612: Operation ("register-server") failed - address: ([]): java.lang.IllegalArgumentException: No enum const class org.jboss.as.controller.audit.SyslogAuditLogHandler$Transport.udp
      at java.lang.Enum.valueOf(Enum.java:214)

      Attachments

        Activity

          People

            tfonteyn Tom Fonteyne (Inactive)
            tfonteyn Tom Fonteyne (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: