In my case I have controller.rar in deployments folder.
I'm using the command line interface jboss-cli.sh / .bat for configuration. See Command Line Interface - Latest WildFly Documentation - Project Documentation Editor for more information.
Putting the necessary commands into a simple text files:
Create the resource adapter if not yet there:
if (outcome != success) of /subsystem=resource-adapters/resource-adapter=controller.rar:read-resource /subsystem=resource-adapters/resource-adapter=controller.rar:add(archive=controller.rar, transaction-support=NoTransaction) end-if
Create the connection with all properties if not yet there:
if (outcome != success) of /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev:read-resource /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev:add(jndi-name="java:/eis/maj2l-dev/ControllerConnector", class-name="biz.mbisoftware.fn.jca.controllerconnector.ManagedConnectionFactoryImpl", enabled=true, validate-on-match=true) /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev/config-properties=ClientService:add(value="JCAClient") /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev/config-properties=SocketTimeout:add(value="0") /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev/config-properties=Encoding:add(value="ISO-8859-15") /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev/config-properties=ServerName:add(value="sb2000") /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2l-dev/config-properties=PortNumber:add(value="6503") /subsystem=resource-adapters/resource-adapter=controller.rar:activate end-if
Thanks for this answer! I hadn't seen the CLI before.
I'm having a hard time getting WildFly to accept the changes. I start WildFly (with my EAR and RAR running) before I run the CLI script so the CLI can connect to my WildFly. I need to remove and re-add the connectors in case anything changed since the last time they were configured. As soon as the script removes the connector my EAR starts throwing exceptions because the connector has been shut down. The script continues and adds the connector, but my EAR can't see it without restarting WildFly.
I'd really like a way to deploy/configure connectors in production without bouncing the app server.
ETA: Also, sometimes I see this error after I remove the resource adapter and try to add it again:
"WFLYCTL0158: Operation handler failed: org.jboss.msc.service.DuplicateServiceException: Service jboss.resourceadapters.ra.udwfile.STATISTICS is already registered"
Remove succeeded, but it seems like it leaves a STATISTICS service hanging around that the add collides with.
ETA: Nevermind. I found the "reload" command. Yikes.
you can start server in admin only mode.
this way you can change its config without any deployments started.
once done just call "reload" command in CLI and server will start in "full" mode.
to start server in admin mode, you can add --admin-only at command line when starting it.
or if it is already started, connect to CLI and run reload --start-mode=admin-only
My goal is to not restart or reload the server at all. The server should be up all the time if possible.