You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by garethahealy <ga...@gmail.com> on 2014/12/17 11:10:47 UTC
MBeanRegistrer unable to bind
I am playing around with org.apache.karaf.management.MBeanRegistrer but when
i deploy to karaf, i get an exception. Below is my code:
<reference id="mbeanServer"
interface="javax.management.MBeanServer">
<reference-listener ref="mbeanRegistrer"
bind-method="registerMBeanServer"
unbind-method="unregisterMBeanServer"/>
</reference>
<bean id="mbeanRegistrer"
class="org.apache.karaf.management.MBeanRegistrer">
<property name="mbeans">
<map>
<entry
value="com.garethahealy:beans=blueprint-mbeans-expose-context,type=beans,name=PoolCounter"
key-ref="poolCounterStandardMBean"/>
</map>
</property>
</bean>
Have checked the management bundle is installed as per:
JBossFuse:admin@esb-uk> list | grep Management
[ 24] [Active ] [Created ] [ ] [ 29] Apache Karaf ::
Management (2.3.0.redhat-610379)
Full project:
https://github.com/garethahealy/jboss-fuse-examples/blob/master/mbeans-expose/src/main/resources/OSGI-INF/blueprint/mbeans-expose-context.xml
Full stack:
2014-12-17 10:09:31,060 | ERROR | Thread-615 | BlueprintContainerImpl
| container.BlueprintContainerImpl 398 | 9 -
org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Unable to start
blueprint container for bundle com.garethahealy.mbeans-expose
org.osgi.service.blueprint.container.ComponentDefinitionException: No
matching methods found for listener bind method: registerMBeanServer
at
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.init(AbstractServiceReferenceRecipe.java:538)
at
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createListeners(AbstractServiceReferenceRecipe.java:286)
at
org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:110)
at
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
at
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
at
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:676)
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:374)
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)
at
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)
at
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)
at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
at
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
at
org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
at
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)
at org.apache.felix.framework.Felix$4.run(Felix.java:2123)
at org.apache.felix.framework.Felix.runInContext(Felix.java:2147)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2121)
at org.apache.felix.framework.Felix.updateBundle(Felix.java:2649)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:960)
at org.apache.karaf.shell.osgi.UpdateBundle.doExecute(UpdateBundle.java:37)
at
org.apache.karaf.shell.osgi.BundleCommand.doExecute(BundleCommand.java:41)
at
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)
at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at
org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
at
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.karaf.shell.console.jline.Console.run(Console.java:189)
at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
at
org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.doRun(ShellFactoryImpl.java:158)[49:org.apache.karaf.shell.ssh:2.3.0.redhat-610379]
at
org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4$1.run(ShellFactoryImpl.java:149)
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_71]
at
org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:47)[27:org.apache.karaf.jaas.modules:2.3.0.redhat-610379]
at
org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.run(ShellFactoryImpl.java:147)[49:org.apache.karaf.shell.ssh:2.3.0.redhat-610379]
Any ideas what i am doing wrong...
--
View this message in context: http://karaf.922171.n3.nabble.com/MBeanRegistrer-unable-to-bind-tp4037265.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: MBeanRegistrer unable to bind
Posted by garethahealy <ga...@gmail.com>.
Hi JB,
I've got it working.
The thing that confused me was when i was looking at the source of
MBeanRegistrer, it had a registerMBeanServer method. Which was incorrect, as
i was looking at the wrong version of the source!
My version uses a ServiceTracker internally. That was the reason it kept
failing.
Cheers.
--
View this message in context: http://karaf.922171.n3.nabble.com/MBeanRegistrer-unable-to-bind-tp4037265p4037268.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: MBeanRegistrer unable to bind
Posted by garethahealy <ga...@gmail.com>.
Hi JB,
Yes, i've done the same as you've described, but still doesn't work.
The code is @
https://github.com/garethahealy/jboss-fuse-examples/blob/master/mbeans-expose/src/main/resources/OSGI-INF/blueprint/mbeans-expose-context.xml
Also, yes, i know the "newer" way is with aries whiteboard, but just playing
around with different ways to work with MBeans.
--
View this message in context: http://karaf.922171.n3.nabble.com/MBeanRegistrer-unable-to-bind-tp4037265p4037267.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: MBeanRegistrer unable to bind
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
I guess that you use 2.3.x ?
You create a interface describing your MBean.
The impl class has to extend javax.management.StandardMBean and
implement your interface.
Once done, in blueprint, you should have:
<bean id="myMBean" class="..."/>
<bean id="mbeanRegistrer"
class="org.apache.karaf.management.MBeanRegistrer">
<property name="mbeans">
<map>
<entry value="domain:id" key-ref="myMBean"/>
</map>
</property>
</bean>
Is it the case (your paste code is not so clean to read) ?
FYI, the MBeanRegistrer has been removed in 3.0.x/4.0.x and replaced by
Aries JMX.
Regards
JB
On 12/17/2014 11:10 AM, garethahealy wrote:
> I am playing around with org.apache.karaf.management.MBeanRegistrer but when
> i deploy to karaf, i get an exception. Below is my code:
>
> <reference id="mbeanServer"
> interface="javax.management.MBeanServer">
> <reference-listener ref="mbeanRegistrer"
> bind-method="registerMBeanServer"
> unbind-method="unregisterMBeanServer"/>
> </reference>
>
> <bean id="mbeanRegistrer"
> class="org.apache.karaf.management.MBeanRegistrer">
> <property name="mbeans">
> <map>
> <entry
> value="com.garethahealy:beans=blueprint-mbeans-expose-context,type=beans,name=PoolCounter"
> key-ref="poolCounterStandardMBean"/>
> </map>
> </property>
> </bean>
>
> Have checked the management bundle is installed as per:
>
> JBossFuse:admin@esb-uk> list | grep Management
> [ 24] [Active ] [Created ] [ ] [ 29] Apache Karaf ::
> Management (2.3.0.redhat-610379)
>
> Full project:
> https://github.com/garethahealy/jboss-fuse-examples/blob/master/mbeans-expose/src/main/resources/OSGI-INF/blueprint/mbeans-expose-context.xml
>
> Full stack:
> 2014-12-17 10:09:31,060 | ERROR | Thread-615 | BlueprintContainerImpl
> | container.BlueprintContainerImpl 398 | 9 -
> org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Unable to start
> blueprint container for bundle com.garethahealy.mbeans-expose
> org.osgi.service.blueprint.container.ComponentDefinitionException: No
> matching methods found for listener bind method: registerMBeanServer
> at
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.init(AbstractServiceReferenceRecipe.java:538)
> at
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createListeners(AbstractServiceReferenceRecipe.java:286)
> at
> org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:110)
> at
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
> at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> at
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
> at
> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:676)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:374)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)
> at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)
> at
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
> at
> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
> at
> org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
> at
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)
> at org.apache.felix.framework.Felix$4.run(Felix.java:2123)
> at org.apache.felix.framework.Felix.runInContext(Felix.java:2147)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2121)
> at org.apache.felix.framework.Felix.updateBundle(Felix.java:2649)
> at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
> at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:960)
> at org.apache.karaf.shell.osgi.UpdateBundle.doExecute(UpdateBundle.java:37)
> at
> org.apache.karaf.shell.osgi.BundleCommand.doExecute(BundleCommand.java:41)
> at
> org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)
> at
> org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
> at
> org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[15:org.apache.felix.gogo.runtime:0.11.0.redhat-610379]
> at
> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
> at org.apache.karaf.shell.console.jline.Console.run(Console.java:189)
> at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> at
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.doRun(ShellFactoryImpl.java:158)[49:org.apache.karaf.shell.ssh:2.3.0.redhat-610379]
> at
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4$1.run(ShellFactoryImpl.java:149)
> at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_71]
> at
> org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:47)[27:org.apache.karaf.jaas.modules:2.3.0.redhat-610379]
> at
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.run(ShellFactoryImpl.java:147)[49:org.apache.karaf.shell.ssh:2.3.0.redhat-610379]
>
> Any ideas what i am doing wrong...
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/MBeanRegistrer-unable-to-bind-tp4037265.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com