One thing first - when using the DeploymentManager, you should check if the operation was successful:
DeploymentProgress stop = deployMgr.stop(dataSourceComponentName);
stop.run();
assertFalse(stop.isFailed());
Hmm, when using the DeploymentManager to stop() and remove() the dataSource deployment you don't not need to call mgtView.removeComponent(dataSourceComponent) in the first place. However even when just calling mgtView.removeComponent(dataSourceComponent) it should *not* deploy the DataSource again (although the deployment might be still there).
AFAIR there were some issues with DataSource managed components in AS5.1.GA (which should be resolved in AS6). Anyway removing the complete deployment using the DeploymentManager should work in either case - so maybe you can validate that the deployment was actually removed.
The problem is that ManagedComponent dataSourceComponent = mgtView.getComponent(this.getDSName(ds), type);
returns a null item , so basically this is where it all fails , because I'm callin stop and remove on a null component.
As I stated earlier when the server is not restart it works perfectly fine.
Thx.
Oh, you are saying after you restart the AppServer "mgtView.getComponent(this.getDSName(ds), type);" returns null for you ManagedComponent? Hmm, i think there was a bug with resolving the RuntimeState of a DataSource after restart - however it obviously should not return null. I'll have to see if i can reproduce the problem.
You are correct.After I restart JBoss mgtView.getComponent(this.getDSName(ds), type); is null. Any help is appreciated.
Thank you Emanuel.