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

Resource adapters subsystem does not accept expression for transaction-support attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 24.0.0.Beta1, 24.0.0.Final
    • 22.0.0.Final
    • JCA
    • None
    • Hide
      1. Run server with atteched config
      2. Execute cli:
      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar:write-attribute(name=transaction-support, value=${test:NoTransaction})
      
      Show
      Run server with atteched config Execute cli: /subsystem=resource-adapters/resource-adapter= generic -jms-ra.rar:write-attribute(name=transaction-support, value=${test:NoTransaction})
    • Undefined
    • ---
    • ---

      Resource adapters subsystem supports expression for transaction-support attribute:

      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar:read-resource-description
      ...
      "transaction-support" => {
                      "type" => STRING,
                      "description" => "Specifies the transaction support level of the resource adapter.",
                      "expressions-allowed" => true,
                      "required" => false,
                      "nillable" => true,
                      "allowed" => [
                          "NoTransaction",
                          "LocalTransaction",
                          "XATransaction"
                      ],
                      "access-type" => "read-write",
                      "storage" => "configuration",
                      "restart-required" => "all-services"
                  },
      
      

      however it fails to marshall it:

      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar:write-attribute(name=transaction-support, value=${test:NoTransaction})
      
      22:20:53,281 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0008: Failed to persist configuration change: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0084: Failed to marshal configuration
      	at org.jboss.as.controller.persistence.AbstractFilePersistenceResource.<init>(AbstractFilePersistenceResource.java:53)
      	at org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource.<init>(ConfigurationFilePersistenceResource.java:46)
      	at org.jboss.as.controller.persistence.BackupXmlConfigurationPersister.store(BackupXmlConfigurationPersister.java:120)
      	at org.jboss.as.controller.ModelControllerImpl.writeModel(ModelControllerImpl.java:728)
      	at org.jboss.as.controller.OperationContextImpl.createPersistenceResource(OperationContextImpl.java:535)
      	at org.jboss.as.controller.AbstractOperationContext.executeDoneStage(AbstractOperationContext.java:821)
      	at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:770)
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:468)
      	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1415)
      	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:431)
      	at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:248)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:304)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:270)
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:248)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:240)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$400(ModelControllerClientOperationHandler.java:138)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:162)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:158)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:328)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:285)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:254)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:225)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:158)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$1.doExecute(ManagementRequestContextImpl.java:70)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$AsyncTaskRunner.run(ManagementRequestContextImpl.java:160)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:513)
      Caused by: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0089: Failed to write configuration
      	at org.jboss.as.controller.persistence.AbstractConfigurationPersister.marshallAsXml(AbstractConfigurationPersister.java:112)
      	at org.jboss.as.controller.persistence.AbstractFilePersistenceResource.<init>(AbstractFilePersistenceResource.java:46)
      	... 30 more
      Caused by: java.lang.IllegalArgumentException: No enum constant org.jboss.jca.common.api.metadata.common.TransactionSupportEnum.${test:NoTransaction}
      	at java.lang.Enum.valueOf(Enum.java:238)
      	at org.jboss.jca.common.api.metadata.common.TransactionSupportEnum.valueOf(TransactionSupportEnum.java:29)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeRaElement(ResourceAdapterSubsystemParser.java:178)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeContent(ResourceAdapterSubsystemParser.java:148)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeContent(ResourceAdapterSubsystemParser.java:130)
      	at org.jboss.as.server.parsing.CommonXml.writeSubsystems(CommonXml.java:281)
      	at org.jboss.as.server.parsing.StandaloneXml_16.writeServerProfile(StandaloneXml_16.java:830)
      	at org.jboss.as.server.parsing.StandaloneXml_16.writeContent(StandaloneXml_16.java:760)
      	at org.jboss.as.server.parsing.StandaloneXml.writeContent(StandaloneXml.java:151)
      	at org.jboss.as.server.parsing.StandaloneXml.writeContent(StandaloneXml.java:52)
      	at org.jboss.staxmapper.XMLMapperImpl.doDeparse(XMLMapperImpl.java:96)
      	at org.jboss.staxmapper.XMLMapperImpl.deparseDocument(XMLMapperImpl.java:91)
      	at org.jboss.as.controller.persistence.AbstractConfigurationPersister.marshallAsXml(AbstractConfigurationPersister.java:106)
      	... 31 more
      

      The error is caused by [1] where the parser does not resolve expression but uses raw string. And there is no enum constant for ${yada yada}.

      Furthermore
      During investigation I have noticed another bug [2]. Function for creating resource adapter object also does not resolve attribute as an expression and raw value is used instead. Can you fix it as well? I don't think we need to have separate issue for this as both bugs regard the same attribute.

      [1] https://github.com/wildfly/wildfly/blob/22.0.0.Final/connector/src/main/java/org/jboss/as/connector/subsystems/resourceadapters/ResourceAdapterSubsystemParser.java#L177
      [2] https://github.com/wildfly/wildfly/blob/22.0.0.Final/connector/src/main/java/org/jboss/as/connector/subsystems/resourceadapters/RaOperationUtil.java#L177

              tadamski@redhat.com Tomasz Adamski
              istraka@redhat.com Ivan Straka
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: