[jboss-jira] [JBoss JIRA] Commented: (JBPORTAL-1730) IdentityServiceControllerImpl : unregister existing MBean service before to re register them

Antoine Herzog (JIRA) jira-events at lists.jboss.org
Wed Apr 2 17:25:58 EDT 2008


    [ http://jira.jboss.com/jira/browse/JBPORTAL-1730?page=comments#action_12406758 ] 
            
Antoine Herzog commented on JBPORTAL-1730:
------------------------------------------

**********************************************************
I replace the IdentityServiceController, by another implementation and another JMX description ... but with the same JMXService name. 
The new service implementation take the place of the jboss original one (replacement).
The JBoss original JMX description is put within comment (the original service is off).

The replacement service is packaged in another proprietary sar.

In the MyIdentityServiceControllerImpl, the IdentityServiceLoader is used exactly the same way as in the original IdentityServiceController code.

The extra code in MyIdentityServiceControllerImpl is for specific initialization of the MBeans, not about registering them.

When I redeploy the Sar package, this exception is thrown from the IdentityServiceLoader :

javax.management.InstanceAlreadyExistsException: portal:service=Module,type=User already registered.
at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:761)
at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:225)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

**********************************************************
The code I propose will unregister the MBean if needed, before to re-register it, and this solve the problem.

**********************************************************
Note about the original portal code : 
In the original code of the portal, it does not seems that the MBean are unregistered before the call of registerMBean.

"That said, all the calls to registerMBean are previously called with unregisterMBean " : this does not seems ok...

make a test : 
 - run the original JBoss Portal, out of the box
 - make a touch of the jboss-service.xml files that are in the 

/server/default/deploy/jboss-portal.sar/portal-identity.sar/META-INF
and 
/server/default/deploy/jboss-portal.sar/META-INF

the server start redeploying ...
the exception is thrown ...

23:04:21,687 WARN  [ServiceController] Problem starting service portal:service=Module,type=IdentityServiceController
org.jboss.portal.identity.IdentityException: Cannot initiate identity modules:
        at org.jboss.portal.core.identity.service.IdentityServiceControllerImpl.startService(IdentityServiceControllerImpl.java:160)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:196)
....
Caused by: javax.management.InstanceAlreadyExistsException: portal:service=Module,type=User already registered.
        at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:761)
        at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:225)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

so, I guess that the service is not unregistered before new one is registered ? or did I missed something ?


**********************************************************
Redeploying the portal sar is not a good idea, as it breaks everything in the portal run.

but when the IdentityServiceController is "replaced" by another implementation, that is in another .sar, then it is very usefull (for me) to be able to redeploy this .sar.

**********************************************************
This problem is the same as the one in the former version.
the Identity services have been reprogrammed with MBean instead of JMX services.
so it is just about the same solution, that was forgotten to "move" to the new implementation.

or I missed something big about all that MBean ?

Thanks,

> IdentityServiceControllerImpl : unregister existing MBean service before to re register them
> --------------------------------------------------------------------------------------------
>
>                 Key: JBPORTAL-1730
>                 URL: http://jira.jboss.com/jira/browse/JBPORTAL-1730
>             Project: JBoss Portal
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: Portal Identity
>    Affects Versions: 2.6.1 Final
>            Reporter: Antoine Herzog
>         Assigned To: Thomas Heute
>            Priority: Optional
>             Fix For: 2.6.5 Final
>
>
> In IdentityServiceControllerImpl (service name="portal:service=Module,type=IdentityServiceController")
> the Identity Beans are registered as JMX MBeans.
> When redeploying the service, an exception is thrown, as the services are yet deployed.
> javax.management.InstanceAlreadyExistsException: portal:service=Module,type=User already registered.
> Let's put this code before to register the bean, at line 378 of IdentityServiceControllerImpl.java
> // Unregister the former service is if it is yet there.
> // This to avoid the exception when redeploying this service
> if (getServer().isRegistered(
> 		new ObjectName(module.getServiceName()))) {
> 	getServer().unregisterMBean(
> 			new ObjectName(module.getServiceName()));
> }
> Thanks,

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list