ISSUE: Our application currently uses the Spring DSL to define a context with a set of routes. What I'm attempting to do is programmatically add/stop/remove new routes to the existing context during runtime based on user actions. I've been able to use JMX to interface with the existing context following this example: http://www.consulting-notes.com/2010/08/managing-camel-routes-with-jmx-apis.html <http://www.consulting-notes.com/2010/08/managing-camel-routes-with-jmx-apis.html> . (Ideally I would like to interface with the existing context and use the Java DSL to manage it, but I haven't found a way to do that yet...) I've been able to add a route and perform a few get requests on it (getStatus, getRouteId, etc.) but whenever I attempt to stop the route, I get a NPE (see stack trace excerpt below). I can confirm through jConsole and our ServiceMix log that the route is stopped. If I then remove it, I receive a similar NPE, but again, it disappears from jConsole. (Additionally, if I then dump the routes from the context, the route is still listed.) This series of NPEs does NOT occur on pre-defined routes.
Can anyone confirm if upgrading would fix this issue or provide some insight one what might be the cause? BACKGROUND: Our application is currently using Camel v.2.8.0. While troubleshooting this issue I came across a similar looking issue ( http://camel.465427.n5.nabble.com/MBean-Runtime-Exception-in-getRoutePolicyList-td4717413.html <http://camel.465427.n5.nabble.com/MBean-Runtime-Exception-in-getRoutePolicyList-td4717413.html> ) which points to a potential issue with JMX registry in older versions of Camel. I'm not sure I can easily upgrade our application to a newer Camel version to try it out so I'm hoping that someone can confirm that this would/wouldn't work in the latest versions. STACK-TRACE javax.management.MBeanException: RuntimeException thrown in RequiredModelMBean while trying to invoke operation stop at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1091) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160) at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:1017) at controllers.proto.Proto.stopRoute(Proto.java:199) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$110$$anonfun$apply$110.apply(routes_routing.scala:1361) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$110$$anonfun$apply$110.apply(routes_routing.scala:1361) at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:164) at play.core.Router$Routes$$anon$1.invocation(Router.scala:345) at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:31) at play.GlobalSettings$1.call(GlobalSettings.java:63) at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:74) at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:73) at play.libs.F$Promise$PromiseActor.onReceive(F.java:420) at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) at akka.actor.ActorCell.invoke(ActorCell.scala:386) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) at akka.dispatch.Mailbox.run(Mailbox.scala:212) at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) Caused by: java.lang.NullPointerException at org.apache.camel.impl.DefaultCamelContext.stopRouteService(DefaultCamelContext.java:1762) at org.apache.camel.impl.DefaultCamelContext.stopRouteService(DefaultCamelContext.java:1756) at org.apache.camel.impl.DefaultCamelContext.stopRoute(DefaultCamelContext.java:763) at org.apache.camel.management.mbean.ManagedRoute.stop(ManagedRoute.java:151) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37) at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1074) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) -- View this message in context: http://camel.465427.n5.nabble.com/NPE-during-stop-start-route-attempts-with-JMX-tp5742131.html Sent from the Camel - Users mailing list archive at Nabble.com.