Problem with Inheritance and javax.resource.spi.work.Work
andreasw Apr 7, 2012 11:41 AMWhile deploying XADisk to JBOSS AS 7.1.1 i encountered some obstacles.
First i encountered exceptions because the ResourceAdapter did not implement equals and hashCode. so i provided them.
Header 1 |
---|
16:27:33,086 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.ra.deployer.XADisk: org.jboss.msc.service.StartException in service jboss.ra.deployer.XADisk: JBAS010446: Failed to start RA deployment [XADisk] at org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService.start(ResourceAdapterDeploymentService.java:103) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22] at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22] Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/opt/jboss-as-7.1.1.Final/standalone/tmp/vfs/temp21defa915e6eedb7/XADisk.rar-4a6847c2a45ad1f0/contents/ at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:2179) at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1034) at org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService$AS7RaDeployer.doDeploy(ResourceAdapterDeploymentService.java:173) at org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService.start(ResourceAdapterDeploymentService.java:100) ... 5 more Caused by: org.jboss.jca.validator.ValidatorException: Severity: ERROR Section: 19.4.2 Description: A ResourceAdapter must implement a "public boolean equals(Object)" method. Code: org.xadisk.connector.XADiskResourceAdapter
Severity: ERROR Section: 19.4.2 Description: A ResourceAdapter must implement a "public int hashCode()" method. Code: org.xadisk.connector.XADiskResourceAdapter |
Next Exception:
Header 1 |
---|
16:34:02,892 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "XADisk.rar" 16:34:03,193 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-8) JBAS010406: Registered connection factory java:global/XADiskCF 16:34:03,282 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.ra.deployment."XADisk.rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."XADisk.rar_1": org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [XADisk] at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:127) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22] at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22] Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [XADisk] at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:111) ... 5 more Caused by: org.jboss.jca.deployers.common.DeployException: IJ020051: Unable to start org.xadisk.connector.XADiskResourceAdapter at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.startContext(AbstractResourceAdapterDeployer.java:350) at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:2139) at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:178) at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:104) ... 5 more Caused by: javax.resource.spi.ResourceAdapterInternalException: org.xadisk.filesystem.exceptions.XASystemBootFailureException: The XADisk instance has encoutered a critial issue and could not be booted. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details. at org.xadisk.connector.XADiskResourceAdapter.start(XADiskResourceAdapter.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_22] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.6.0_22] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.6.0_22] at java.lang.reflect.Method.invoke(Method.java:616) [rt.jar:1.6.0_22] at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.startContext(AbstractResourceAdapterDeployer.java:346) ... 8 more Caused by: org.xadisk.filesystem.exceptions.XASystemBootFailureException: The XADisk instance has encoutered a critial issue and could not be booted. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details. at org.xadisk.filesystem.NativeXAFileSystem.<init>(NativeXAFileSystem.java:186) at org.xadisk.filesystem.NativeXAFileSystem.bootXAFileSystem(NativeXAFileSystem.java:202) at org.xadisk.connector.XADiskResourceAdapter.start(XADiskResourceAdapter.java:38) ... 13 more Caused by: javax.resource.spi.work.WorkException: org.xadisk.filesystem.workers.DeadLockDetector: Run method is not defined at org.jboss.jca.core.workmanager.WorkManagerImpl.verifyWorkMethods(WorkManagerImpl.java:716) at org.jboss.jca.core.workmanager.WorkManagerImpl.verifyWork(WorkManagerImpl.java:681) at org.jboss.jca.core.workmanager.WorkManagerImpl.checkAndVerifyWork(WorkManagerImpl.java:656) at org.jboss.jca.core.workmanager.WorkManagerImpl.startWork(WorkManagerImpl.java:378) at org.xadisk.filesystem.NativeConcurrencyControl.<init>(NativeConcurrencyControl.java:41) at org.xadisk.filesystem.NativeXAFileSystem.<init>(NativeXAFileSystem.java:164) ... 15 more |
Im interested in why a resource adapter has to override equals.
Also I think the validation of the WorkMethods is not correct. The WorkManager verifies if the 2 Methods of javax.resource.spi.work.Work are implemented in the class.
In the described case both methods were implemented in a superclass of DeadLockDetector, so they were there.
To get things working, I had to implement the methods and delegate to their superclass.
The current implementation denies inheritance, is this the desired behaviour?