Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1129400 - Unable to create resource-adapter using HTTP management interface
Unable to create resource-adapter using HTTP management interface
Status: VERIFIED
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Domain Management (Show other bugs)
6.2.4
Unspecified Unspecified
unspecified Severity medium
: DR1
: EAP 6.4.0
Assigned To: Brian Stansberry
Petr Kremensky
:
Depends On:
Blocks: 1116788
  Show dependency treegraph
 
Reported: 2014-08-12 12:45 EDT by Libor Zoubek
Modified: 2018-03-06 15:39 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In previous versions of JBoss EAP 6, the logic in the operation to add a resource-adapter resource required that the target address be represented as a list of elements of DMR ModelType.PROPERTY. This meant that HTTP-based management clients that used JSON could not reliably create operations using the expected format (as representing the $PROPERTY element in JSON syntax can be problematic). In this release of JBoss EAP 6, the handler for the resource-adapter `add` operation has been updated to use standard address parsing code which is more forgiving of formatting differences. As a result, operations that add a resource-adapter using the HTTP interface and JSON similar to the example above now succeed as expected.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-3732 Major Resolved RaOperationUtil cannot handle unusual address formats 2014-09-08 10:45:21 EDT

  None (edit)
Description Libor Zoubek 2014-08-12 12:45:37 EDT
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"}
Comment 1 Brian Stansberry 2014-08-12 13:12:54 EDT
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.
Comment 2 Brian Stansberry 2014-08-13 18:56:23 EDT
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.
Comment 3 JBoss JIRA Server 2014-08-13 19:41:31 EDT
Brian Stansberry <brian.stansberry@redhat.com> updated the status of jira WFLY-3732 to Resolved

Note You need to log in before you can comment on or make changes to this bug.