Description of problem: JON plugin fails to create resource-adapters using HTTP management API, it can be created only using CLI. Version-Release number of selected component (if applicable): EAP 6.2.4.GA How reproducible: always Steps to Reproduce: 1. Create resource adapter via curl curl --digest -u admin:admin http://localhost:9990/management -H "Content-Type: application/json" -H "Accept: */*" -v -X POST --data '{"operation":"add","address":[{"subsystem":"resource-adapters"},{"resource-adapter":"my-adapter"}],"archive":"test"}' Actual results: it fails with response: {"outcome" : "failed", "failure-description" : "JBAS014749: Operation handler failed: null", "rolled-back" : true} Server stacktrace: 18:38:41,086 ERROR [org.jboss.as.controller.management-operation] (HttpManagementService-threads - 10) JBAS014612: Operation ("add") failed - address: ([ {"subsystem" => "resource-adapters"}, {"resource-adapter" => "my-adapter"} ]): java.lang.IllegalArgumentException at org.jboss.dmr.ModelValue.getChild(ModelValue.java:120) [jboss-dmr-1.2.0.Final-redhat-1.jar:1.2.0.Final-redhat-1] at org.jboss.dmr.ModelNode.get(ModelNode.java:903) [jboss-dmr-1.2.0.Final-redhat-1.jar:1.2.0.Final-redhat-1] at org.jboss.as.connector.subsystems.resourceadapters.RaOperationUtil.buildResourceAdaptersObject(RaOperationUtil.java:145) at org.jboss.as.connector.subsystems.resourceadapters.RaAdd.performRuntime(RaAdd.java:76) at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:76) [jboss-as-controller-7.3.4.Final-redhat-1.jar:7.3.4.Final-redhat-1] Expected results: {"outcome" => "success"} Additional info: It's possible to create resource-adapter only via CLI [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=my2nd-adapter:add(archive=test) {"outcome" => "success"}
Not a CLI bug, since it seems the CLI works. This is either a core Domain Management issue, in how it reads the HTTP request, or a problem in the JCA component.
The problem here is RaOperationUtil is using a very unorthodox method of reading the address of the operation: final List<ModelNode> address = operation.get(ModelDescriptionConstants.ADDRESS).asList(); final String id = address.get(address.size()-1).get(0).asString(); The issue is the ModelNode returned by "address.get(address.size()-1)". When you use the CLI, the ModelNode is of ModelType.PROPERTY. To create a ModelNode of ModelType.PROPERTY using JSON syntax is difficult. (TBH I'm not sure how to do it.) The syntax in the curl command results in a node of ModelType.OBJECT. That get(0) call fails on ModelType.OBJECT. It's quite the quirk that it works for ModelType.PROPERTY. Easy fix.
Brian Stansberry <brian.stansberry> updated the status of jira WFLY-3732 to Resolved