jbossas/jboss-as-maven-plugin — pull request #12 by jbrownfield (2012-01-29 08:41:15+00:00)
Title: Attempt to fix exception during xa-datasource deployment

If adding xa-datasource-properties, an exception was generated because
the xa-datasource was enabled before any of the
xa-datasource-properties had been added. This changes the
enableResource to execute after all resources have been added. I
believe this is an imperfect solution. I will discuss this with the
other developers.

James: One of the reasons I implemented my patch as a "subresource" was that it appeared the xa-datasource-properties needed to be added before the xa-datasource was enabled. With 7.1.0.CR1b, I was getting the following exception (more text after the exception):

*** Start log excerpt ***
02:58:28,491 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.data-source.java:jboss/datasources/RCATSPool: org.jboss.msc.service.StartException in service jboss.data-source.java:jboss/datasources/RCATSPool: JBAS010433: Error during the deployment of RCATSPool
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:118)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_29]
Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010069: Missing required element xa-datasource-property in org.jboss.jca.common.metadata.ds.XADataSourceImpl
at org.jboss.jca.common.metadata.ds.XADataSourceImpl.validate(XADataSourceImpl.java:384)
at org.jboss.jca.common.metadata.ds.XADataSourceImpl.(XADataSourceImpl.java:115)
at org.jboss.as.connector.subsystems.datasources.ModifiableXaDataSource.getUnModifiableInstance(ModifiableXaDataSource.java:372)
at org.jboss.as.connector.subsystems.datasources.XaDataSourceService.getDeployer(XaDataSourceService.java:66)
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService.start(AbstractDataSourceService.java:111)
... 5 more

*** End log excerpt ***

Reversing the order of the "resource" definitions so the xa-datasource would be started last caused the xa-datasource-properties not to be added at all.

I modified the code to only allow one "enableResource", and that enable is done after all the resources are added. This seems to have made my exception go away, but it's not a great solution. I think the resources need to be grouped into resources and sub-resources in some manner to allow a more generic implementation.

It's also, of course, possible that I'm missing some overarching concept here, but this is how it appears to work to me.

Take care,
Jim