Aaah - I see that you are calling "remove" on the bean (which translates to a
unregister eventually)
So - Ignore my previous post.
The beans that you are creating have the following dependencies in the
direction of the arrow
NoTxCM --> ManagedConnectionPool --> ManagedConnectionFactory
i.e. The NoTxCM depends on the ManagedConnectionPool .... etc
You therefore need to stop/destroy the beans and remove them so that the
dependencies are not broken:
| ObjectName mcFactoryName = new
ObjectName("jboss.jca:service=ManagedConnectionFactory,name=MyDS");
| ObjectName mcPoolName = new
ObjectName("jboss.jca:service=ManagedConnectionPool,name=MyDS");
| ObjectName txConManagerName = new
ObjectName("jboss.jca:service=NoTxCM,name=MyDS");
|
| // stop and destroy in the order of dependencies
| stopAndDestroyMBean(mcFactoryName);
| stopAndDestroyMBean(mcPoolName);
| stopAndDestroyMBean(txConManagerName);
|
| // remove in the reverse order of dependencies
| removeMBean(txConManagerName);
| removeMBean(mcPoolName);
| removeMBean(mcFactoryName);
|
| // create in the reverse order of dependencies
| createManagedConnectionFactory(mcFactoryName);
| createManagedConnectionPool(mcPoolName, mcFactoryName);
| createTxConManager(txConManagerName, mcPoolName);
|
| private void stopAndDestroyMBean(ObjectName name) throws Exception {
| ObjectName serviceControllerName = new ObjectName(
| "jboss.system:service=ServiceController");
|
| if (getServer().isRegistered(name)) {
| getServer().invoke(serviceControllerName, "stop",
| new Object[] { name },
| new String[] { "javax.management.ObjectName" });
| getServer().invoke(serviceControllerName, "destroy",
| new Object[] { name },
| new String[] { "javax.management.ObjectName" });
| }
| }
|
| private void removeMBean(ObjectName name) throws Exception {
|
| ObjectName serviceControllerName = new ObjectName(
| "jboss.system:service=ServiceController");
|
| if (getServer().isRegistered(name)) {
| getServer().invoke(serviceControllerName, "remove",
| new Object[] { name },
| new String[] { "javax.management.ObjectName" });
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3897100#3897100
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3897100
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user