Hi JB,
thanks for your quick response.
I just did a depper look into my problem, and indeed it seems not to
be a general issue. :-)
Sorry for the inconvenience.
I think, I could find a little bit more details:
Running a CamelContext with a full defined route works fine.
But I have some features, to create (multiple) routes per
configuration, so every configuration defines the source and
destination endpoint, and a pre-defined route will be created.
Example:
for (GSConfiguration config : configurationMap.values()) {
validateFailOnEPNotExist(config);
FileEndpointConfiguration configuration =
(FileEndpointConfiguration) config;
try {
createFileRoute(configuration);
} catch (Exception e) {
LOGGER.warn("No valid configuration set for context {} and
configuration {}.", getInterfaceContext(), config.getId());
}
}
Now I enabled JMX in blueprint file, but the result iis the same.
(Isn't JMX enabled by default?)
<camelContext id="gs-file-adapter"
xmlns="http://camel.apache.org/schema/blueprint" trace="false">
<package>aero.groundstar.gslisa.base.connector.file.routes</package>
<jmxAgent id="agent" usePlatformMBeanServer="true" />
</camelContext>
As this is a historical implementation which works with camel-2.16.5
and karaf 4.0.9 (aka servicemix 7.0.1), I think RouteTemplate will be
the better solution.
I will test it and come back in case the issue appears again.
Sorry again for the inconvenience.
Joerg
Am Fr., 22. Jan. 2021 um 08:00 Uhr schrieb Jean-Baptiste Onofre
<[email protected]>:
>
> 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
>