You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/05/08 07:56:04 UTC

[jira] [Updated] (CAMEL-11234) NullPointerException while trying to get the Route Status on startup

     [ https://issues.apache.org/jira/browse/CAMEL-11234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-11234:
--------------------------------
    Priority: Minor  (was: Major)

> NullPointerException while trying to get the Route Status on startup
> --------------------------------------------------------------------
>
>                 Key: CAMEL-11234
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11234
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.18.2
>         Environment: Spring Boot 1.5.1
>            Reporter: Raul Astudillo Markoch
>            Priority: Minor
>
> Using a class that extends EventNotifierSupport, we advise a route by adding a processor in between two outputs.
> It looks like this
> from().processor().bean().processor().processor(advised),to().
> To add the adviceWith processor we listen to the routeAdded event and advice the route.
> While Camel is starting up there is a line (line number 2966) in the DefaultCamelContext that loops through the available routes for later logging the amount of routes started in the context. This calls for a method ( if(this.getRouteStatus(route.getId()).isStarted()) { ) that may return null if there are no routes running while this is being done, so IT WILL throw a NullPointerException.
> Since I'm advising routes while the context is being started, the route gets stopped and restarted, meanwhile the aforementioned method gets called and BUM.... NullPointerException.
> Here's the stacktrace:
> org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.NullPointerException
> 	at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:124) ~[camel-spring-boot-2.18.2.jar:2.18.2]
> 	at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:41) ~[camel-spring-boot-2.18.2.jar:2.18.2]
> 	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
> 	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.springframework.boot.SpringApplication$run.call(Unknown Source) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all-2.4.7.jar:2.4.7]
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all-2.4.7.jar:2.4.7]
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-all-2.4.7.jar:2.4.7]
> 	at com.my.app.ApplicationMain.main(ApplicationMain.groovy:12) [main/:?]
> Caused by: java.lang.NullPointerException
> 	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2943) ~[camel-core-2.18.2.jar:2.18.2]
> 	at org.apache.camel.spring.boot.RoutesCollector.maybeStart(RoutesCollector.java:141) ~[camel-spring-boot-2.18.2.jar:2.18.2]
> 	at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:116) ~[camel-spring-boot-2.18.2.jar:2.18.2]
> 	... 17 more



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)