如何使用REST接口在Glassfish 3.1.2中创建连接器连接池

时间:2013-01-25 15:13:06

标签: rest glassfish

对于多个Glassfish 3.1.2.2实例的远程管理,我想配置资源适配器连接池和连接器资源。这些配置只能在资源适配器部署后完成。

如果我使用asadmin做事,一切正常。

通过REST获取Access可以按预期工作 例如:

curl --user admin:pwd -X GET -H "Accept: application/JSON" 
     http://localhost:4848/management/domain/resources/connector-connection-pool

现在我想使用带有REST的以下命令创建连接池

asadmin create-connector-connection-pool --raname MulticastDNS-connector
         --connectiondefinition multicastdns.outbound.MulticastDNSRegistry multicastdns/pool 

我遵循了一些Oracle示例
http://docs.oracle.com/cd/E18930_01/html/821-2416/gjipx.html#gjijx
http://docs.oracle.com/cd/E19798-01/821-1751/gjijx/index.html
但我尝试的所有东西都有400个不良请求。
例如:

curl --user admin:pwd -X POST -H "Accept: application/JSON" -H "Content-Type: application/json"
     -d '{"id":"multicastdn%2fspool","connectiondefinitionname":"multicastdns.outbound.MulticastDNSRegistry","resourceAdapterName":"MulticastDNS-connector"}'\
     http://localhost:4848/management/domain/resources/connector-connection-pool -v

# other check
curl --user admin:pwd -X POST -H "Accept: application/JSON" \
    -d id=multicastdns%2fpool \
    -d connectiondefinitionname=multicastdns.outbound.MulticastDNSRegistry \
    -d resourceAdapterName=MulticastDNS-connector \
    http://localhost:4848/management/domain/resources/connector-connection-pool -v

如果我想删除现有资源,则为Simular结果。

curl --user admin:pwd -X DELETE -H "Accept: application/JSON" \ 
     http://localhost:4848/management/domain/resources/connector-connection-pool/multicastdns%2fpool -v

# other try
curl --user admin:pwd -X DELETE -H "Accept: application/JSON" \
     -d id=multicastdns%2fpool \
     http://localhost:4848/management/domain/resources/connector-connection-pool -v


如果使用连接器资源尝试第二步,则会出现同样的问题      asadmin create-connector-resource --poolname multicastdns / pool jca / multicastdns

通过REST获取,但添加和删除条目将无效。

Thanx florian

0 个答案:

没有答案