I just tested on Karaf 4.3.0 with Camel 3.7.0, and it works fine for me:

karaf@root()> camel:route-list 
 Context        Route          Status              Total #       Failed #     
Inflight #   Uptime        
 -------        -----          ------              -------       --------     
----------   ------        
 camel-1        test           Started                   1              0       
       0   2s492ms 

karaf@root()> info
Karaf
  Karaf version               4.3.0

07:58:39.456 INFO [Blueprint Event Dispatcher: 1] Attempting to start 
CamelContext: camel-1
07:58:39.472 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
07:58:39.581 INFO [Blueprint Event Dispatcher: 1] Apache Camel 3.7.0 (camel-1) 
is starting
07:58:39.583 INFO [Blueprint Event Dispatcher: 1] MDC logging is enabled on 
CamelContext: camel-1
07:58:39.655 INFO [Blueprint Event Dispatcher: 1] StreamCaching is not in use. 
If using streams then it's recommended to enable stream caching. See more 
details at http://camel.apache.org/stream-caching.html
07:58:39.689 INFO [Blueprint Event Dispatcher: 1] Route: test started and 
consuming from: timer://fire
07:58:39.694 INFO [Blueprint Event Dispatcher: 1] Total 1 routes, of which 1 
are started
07:58:39.694 INFO [Blueprint Event Dispatcher: 1] Apache Camel 3.7.0 (camel-1) 
started in 111ms

I think JMX is not enabled in your case. Can you try with JMX enabled ?

Thanks,
Regards
JB

> Le 22 janv. 2021 à 07:46, Jörg Jansen <[email protected]> a écrit :
> 
> Hi everybody,
> 
> I'm running camel (3.7.0) in a karaf container (4.3.0).
> When trying to list all routes with command route-list, I receive the
> following error message:
> 
>      Error executing command: Cannot invoke
> "org.apache.camel.api.management.mbean.ManagedRouteMBean.getExchangesTotal()"
> because "mr" is null
> 
> 
> Stacktrace:
> 15:41:35.669 ERROR [Karaf local console user karaf] Exception caught
> while executing command
> java.lang.NullPointerException: Cannot invoke
> "org.apache.camel.api.management.mbean.ManagedRouteMBean.getExchangesTotal()"
> because "mr" is null
>        at 
> org.apache.camel.commands.AbstractLocalCamelController.getRoutes(AbstractLocalCamelController.java:291)
> ~[?:?]
>        at 
> org.apache.camel.commands.AbstractLocalCamelController.getRoutes(AbstractLocalCamelController.java:306)
> ~[?:?]
>        at 
> org.apache.camel.commands.AbstractLocalCamelController.getRoutes(AbstractLocalCamelController.java:271)
> ~[?:?]
>        at 
> org.apache.camel.commands.RouteListCommand.execute(RouteListCommand.java:54)
> ~[?:?]
>        at org.apache.camel.karaf.commands.RouteList.execute(RouteList.java:39)
> ~[?:?]
>        at 
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>        at 
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>        at 
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
> ~[?:?]
>        at 
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> ~[?:?]
>        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>        at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
> ~[?:?]
>        at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
> ~[?:?]
>        at java.lang.Thread.run(Thread.java:832) [?:?]
> 
> Maybe I'm missing something, but have no idea, what.
> 
> Does anybody has an idea, what the reason could be.
> 
> Thanks in advance,
> Joerg

Reply via email to