trying to get ManagedComponent removal/deletion working
ips May 13, 2009 10:48 PMI am trying to re-enable the ManagedComponent deletion code in the AS4 Jopr plugin, calling redeploy() on the parent deployment after
DeploymentManager deploymentManager = getConnection().getDeploymentManager(); /*if (!deploymentManager.isRedeploySupported()) throw new UnsupportedOperationException("Deletion of " + getResourceContext().getResourceType().getName() + " Resources is not currently supported.");*/ ManagedComponent managedComponent = getManagedComponent(); log.debug("Removing " + getResourceDescription() + " with component " + toString(managedComponent) + "..."); ManagementView managementView = getConnection().getManagementView(); managementView.removeComponent(managedComponent); managementView.load(); ManagedDeployment parentDeployment = managedComponent.getDeployment(); log.debug("Redeploying parent deployment '" + parentDeployment.getName() + "' in order to complete removal of component " + toString(managedComponent) + "..."); DeploymentProgress progress = deploymentManager.redeploy(parentDeployment.getName()); DeploymentUtils.run(progress);
Unfortunately, the redeploy call results in the following exception:
22:23:50,921 DEBUG [ManagedComponentComponent] Removing ResourceType[id=0, category=Service, name=Local Tx Datasource, p lugin=JBossAS5] Resource with key [DataSource:LocalTx:MyOracleLocalTxDS] with component TempManagedComponentImpl@2476216 9[type=ComponentType{type=DataSource, subtype=LocalTx}, name=MyOracleLocalTxDS, properties=HashMap@5739137]... 22:23:51,030 DEBUG [ManagedComponentComponent] Redeploying parent deployment 'vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/se rver/default/deploy/MyOracleLocalTxDS-ds.xml' in order to complete removal of component TempManagedComponentImpl@2476216 9[type=ComponentType{type=DataSource, subtype=LocalTx}, name=MyOracleLocalTxDS, properties=HashMap@5739137]... 22:23:51,108 INFO [DeployHandler] Stop, [vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLocalTxD S-ds.xml] 22:23:51,155 INFO [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=DataSourceBinding,name =MyOracleLocalTxDS' from JNDI name 'MyOracleLocalTxDS' 22:23:51,187 INFO [DeployHandler] End stop, [vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLoca lTxDS-ds.xml] 22:23:51,187 INFO [DeployHandler] Begin start, [vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleL ocalTxDS-ds.xml] 22:23:51,265 ERROR [AbstractKernelController] Error installing to PreReal: name=vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/ server/default/deploy/MyOracleLocalTxDS-ds.xml state=PostClassLoader mode=Manual requiredState=PreReal org.jboss.deployers.spi.DeploymentException: Error during deploy: vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default /deploy/MyOracleLocalTxDS-ds.xml at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.start(AbstractDeployHandler.java:26 2) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.redeploy(AbstractDeployHandler.java :349) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.invoke(AbstractDeployHandler.java:1 94) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891) at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106) at org.jboss.remoting.Client.invoke(Client.java:1724) at org.jboss.remoting.Client.invoke(Client.java:629) at org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget.invoke(StreamingDeploymentTarge t.java:305) at org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget.redeploy(StreamingDeploymentTar get.java:146) at org.jboss.profileservice.management.upload.DeploymentProgressImpl.redeploy(DeploymentProgressImpl.java:366) at org.jboss.profileservice.management.upload.DeploymentProgressImpl.run(DeploymentProgressImpl.java:97) at org.rhq.plugins.jbossas5.util.DeploymentUtils.run(DeploymentUtils.java:93) at org.rhq.plugins.jbossas5.ManagedComponentComponent.deleteResource(ManagedComponentComponent.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:480) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve schema nsURI= location=root at org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects.loadAttachment(LazyPredete rminedManagedObjects.java:198) at org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects.getAttachment(LazyPredeter minedManagedObjects.java:131) at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getAttachment(AbstractDeploymentUnit.java:35 6) at org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer.internalDeploy( ProfileServicePersistenceDeployer.java:79) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) ... 36 more Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve schema nsURI= location=root at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203) at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:183) at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:161) at org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer.loadAttachment(JAXBAttachmentSeria lizer.java:83) at org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer.loadAttachment(AbstractFi leAttachmentsSerializer.java:71) at org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects.loadAttachment(LazyPredete rminedManagedObjects.java:194) ... 41 more Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to resolve schema nsURI= location=root at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:281) at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java: 401) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199) ... 46 more 22:23:51,296 INFO [DeployHandler] Failed to complete command: [redeploy] for deployment: names=[vfsfile:/C:/opt/jboss-5 .1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLocalTxDS-ds.xml], copyContent=true org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** DEPLOYMENTS IN ERROR: Name -> Error vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLocalTxDS-ds.xml -> org.jboss.deployers.spi.Deploy mentException: Error during deploy: vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLocalTxDS-ds.x ml DEPLOYMENTS IN ERROR: Deployment "vfsfile:/C:/opt/jboss-5.1.0.GA-SNAPSHOT/server/default/deploy/MyOracleLocalTxDS-ds.xml" is in error due to the following reason(s): org.jboss.xb.binding.JBossXBRuntimeException: Failed to resolve schema nsURI= location=root at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993) at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java: 128) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.start(AbstractDeployHandler.java:26 4) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.redeploy(AbstractDeployHandler.java :349) at org.jboss.profileservice.management.upload.remoting.AbstractDeployHandler.invoke(AbstractDeployHandler.java:1 94) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891) at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106) at org.jboss.remoting.Client.invoke(Client.java:1724) at org.jboss.remoting.Client.invoke(Client.java:629) at org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget.invoke(StreamingDeploymentTarge t.java:305) at org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget.redeploy(StreamingDeploymentTar get.java:146) at org.jboss.profileservice.management.upload.DeploymentProgressImpl.redeploy(DeploymentProgressImpl.java:366) at org.jboss.profileservice.management.upload.DeploymentProgressImpl.run(DeploymentProgressImpl.java:97) at org.rhq.plugins.jbossas5.util.DeploymentUtils.run(DeploymentUtils.java:93) at org.rhq.plugins.jbossas5.ManagedComponentComponent.deleteResource(ManagedComponentComponent.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:480) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
Also, I had to comment out the deploymentManager.isRedeploySupported() check, because it was returning false. Shouldn't that be returning true? Or perhaps it is returning false to protect me from the exception above :-)