Is the CamelContext started when you call this code? As its when the mangement agent is started it initializes the mbean server.
You can also get the mbean server using return ManagementFactory.getPlatformMBeanServer(); This is what Camel uses by default. On Thu, Apr 9, 2015 at 11:15 AM, dermoritz <[email protected]> wrote: > I want to register an own MBean (dynamic MBean) in my Camel application. For > this i use > context.getManagementStrategy().getManagementAgent().getMBeanServer().registerMBean(dMBean, > null); > > The problem is that "getMBeanServer()" returns null. Javadoc says: "Notice: > If the JMXEnabled configuration is not set to true, this method will return > null." > > But i am quite sure that jmx is enable - i am using it all the time. > > My program flow is as follow: > > - creating context -> new DefaultCamelContext (i use Guice and bound > DefaultCamelContext to CamelContext) > - adding a routbuilder to context > - registering my dynamic mbean > - starting the context (call of main.run()) > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/getMBeanServer-returns-null-on-DefaultCamelContext-why-tp5765507.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
