You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Dan Tran <da...@gmail.com> on 2012/01/11 23:03:58 UTC

JMException throws during bundle reloads due to properties file changes

Hi I have a bundle with a MBean with it. When I changes a properties
belong to my bundle viat etc/my.bundle.cfg, karaf throws the following
execption


2012-01-11 13:33:54,221 | ERROR | rint Extender: 3 |
tServiceReferenceRecipe$Listener | tServiceReferenceRecipe$Listener
451 | 9 - org.apache.aries.blueprint - 0.3.1 | Error calling listener
method public void
org.apache.karaf.management.MBeanRegistrer.registerMBeanServer(javax.management.MBeanServer)
throws javax.management.JMException
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.7.0_b147]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_b147]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_b147]
        at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_b147]
        at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[9:org.apache.aries.blueprint:0.3.1]
        at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.invokeMethods(AbstractServiceReferenceRecipe.java:448)[9:org.apache.aries.blueprint:0.3.1]
        at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.bind(AbstractServiceReferenceRecipe.java:430)[9:org.apache.aries.blueprint:0.3.1]
        at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.bind(AbstractServiceReferenceRecipe.java:327)[9:org.apache.aries.blueprint:0.3.1]
        ........
Caused by: javax.management.InstanceAlreadyExistsException:
com.mycomp.mc.root:type=target,name=assets


So it seems karaf does not un-register my MBean first.


Note, and can use karaf shell to restart my bundle ( restart xyz), no
exception here.


 Is it a bug?

No so, after restart, the bundle 'seems' to operate, but I dont really
know the ramifications are.


One of work around, I am thinking, is to move the MBEANs another
bundle so that it never get reload. If it is a bug, should I go for
the workaround?


Thanks

-Dan

Re: JMException throws during bundle reloads due to properties file changes

Posted by Dan Tran <da...@gmail.com>.
Thanks JB,

I also try to reproduce this using karaf mbean, but so far I am not
able to find a karaf's mbean similar to what i have.

-D

On Wed, Jan 11, 2012 at 11:05 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Hi Dan,
>
> let me try to reproduce, it looks like in some case, the Karaf
> MBeanRegistrer doesn't unregister the MBean from the MBean server.
>
> I keep you posted.
>
> Regards
> JB
>
>
> On 01/11/2012 11:03 PM, Dan Tran wrote:
>>
>> Hi I have a bundle with a MBean with it. When I changes a properties
>> belong to my bundle viat etc/my.bundle.cfg, karaf throws the following
>> execption
>>
>>
>> 2012-01-11 13:33:54,221 | ERROR | rint Extender: 3 |
>> tServiceReferenceRecipe$Listener | tServiceReferenceRecipe$Listener
>> 451 | 9 - org.apache.aries.blueprint - 0.3.1 | Error calling listener
>> method public void
>>
>> org.apache.karaf.management.MBeanRegistrer.registerMBeanServer(javax.management.MBeanServer)
>> throws javax.management.JMException
>> java.lang.reflect.InvocationTargetException
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)[:1.7.0_b147]
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_b147]
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_b147]
>>         at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_b147]
>>         at
>> org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.invokeMethods(AbstractServiceReferenceRecipe.java:448)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.bind(AbstractServiceReferenceRecipe.java:430)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.bind(AbstractServiceReferenceRecipe.java:327)[9:org.apache.aries.blueprint:0.3.1]
>>         ........
>> Caused by: javax.management.InstanceAlreadyExistsException:
>> com.mycomp.mc.root:type=target,name=assets
>>
>>
>> So it seems karaf does not un-register my MBean first.
>>
>>
>> Note, and can use karaf shell to restart my bundle ( restart xyz), no
>> exception here.
>>
>>
>>  Is it a bug?
>>
>> No so, after restart, the bundle 'seems' to operate, but I dont really
>> know the ramifications are.
>>
>>
>> One of work around, I am thinking, is to move the MBEANs another
>> bundle so that it never get reload. If it is a bug, should I go for
>> the workaround?
>>
>>
>> Thanks
>>
>> -Dan
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: JMException throws during bundle reloads due to properties file changes

Posted by Dan Tran <da...@gmail.com>.
Thanks JB,

I also try to reproduce this using karaf mbean, but so far I am not
able to find a karaf's mbean similar to what i have.

-D

On Wed, Jan 11, 2012 at 11:05 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Hi Dan,
>
> let me try to reproduce, it looks like in some case, the Karaf
> MBeanRegistrer doesn't unregister the MBean from the MBean server.
>
> I keep you posted.
>
> Regards
> JB
>
>
> On 01/11/2012 11:03 PM, Dan Tran wrote:
>>
>> Hi I have a bundle with a MBean with it. When I changes a properties
>> belong to my bundle viat etc/my.bundle.cfg, karaf throws the following
>> execption
>>
>>
>> 2012-01-11 13:33:54,221 | ERROR | rint Extender: 3 |
>> tServiceReferenceRecipe$Listener | tServiceReferenceRecipe$Listener
>> 451 | 9 - org.apache.aries.blueprint - 0.3.1 | Error calling listener
>> method public void
>>
>> org.apache.karaf.management.MBeanRegistrer.registerMBeanServer(javax.management.MBeanServer)
>> throws javax.management.JMException
>> java.lang.reflect.InvocationTargetException
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)[:1.7.0_b147]
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_b147]
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_b147]
>>         at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_b147]
>>         at
>> org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.invokeMethods(AbstractServiceReferenceRecipe.java:448)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.bind(AbstractServiceReferenceRecipe.java:430)[9:org.apache.aries.blueprint:0.3.1]
>>         at
>> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.bind(AbstractServiceReferenceRecipe.java:327)[9:org.apache.aries.blueprint:0.3.1]
>>         ........
>> Caused by: javax.management.InstanceAlreadyExistsException:
>> com.mycomp.mc.root:type=target,name=assets
>>
>>
>> So it seems karaf does not un-register my MBean first.
>>
>>
>> Note, and can use karaf shell to restart my bundle ( restart xyz), no
>> exception here.
>>
>>
>>  Is it a bug?
>>
>> No so, after restart, the bundle 'seems' to operate, but I dont really
>> know the ramifications are.
>>
>>
>> One of work around, I am thinking, is to move the MBEANs another
>> bundle so that it never get reload. If it is a bug, should I go for
>> the workaround?
>>
>>
>> Thanks
>>
>> -Dan
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: JMException throws during bundle reloads due to properties file changes

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Dan,

let me try to reproduce, it looks like in some case, the Karaf 
MBeanRegistrer doesn't unregister the MBean from the MBean server.

I keep you posted.

Regards
JB

On 01/11/2012 11:03 PM, Dan Tran wrote:
> Hi I have a bundle with a MBean with it. When I changes a properties
> belong to my bundle viat etc/my.bundle.cfg, karaf throws the following
> execption
>
>
> 2012-01-11 13:33:54,221 | ERROR | rint Extender: 3 |
> tServiceReferenceRecipe$Listener | tServiceReferenceRecipe$Listener
> 451 | 9 - org.apache.aries.blueprint - 0.3.1 | Error calling listener
> method public void
> org.apache.karaf.management.MBeanRegistrer.registerMBeanServer(javax.management.MBeanServer)
> throws javax.management.JMException
> java.lang.reflect.InvocationTargetException
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.7.0_b147]
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_b147]
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_b147]
>          at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_b147]
>          at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[9:org.apache.aries.blueprint:0.3.1]
>          at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.invokeMethods(AbstractServiceReferenceRecipe.java:448)[9:org.apache.aries.blueprint:0.3.1]
>          at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.bind(AbstractServiceReferenceRecipe.java:430)[9:org.apache.aries.blueprint:0.3.1]
>          at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.bind(AbstractServiceReferenceRecipe.java:327)[9:org.apache.aries.blueprint:0.3.1]
>          ........
> Caused by: javax.management.InstanceAlreadyExistsException:
> com.mycomp.mc.root:type=target,name=assets
>
>
> So it seems karaf does not un-register my MBean first.
>
>
> Note, and can use karaf shell to restart my bundle ( restart xyz), no
> exception here.
>
>
>   Is it a bug?
>
> No so, after restart, the bundle 'seems' to operate, but I dont really
> know the ramifications are.
>
>
> One of work around, I am thinking, is to move the MBEANs another
> bundle so that it never get reload. If it is a bug, should I go for
> the workaround?
>
>
> Thanks
>
> -Dan

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com