camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Thun (JIRA)" <>
Subject [jira] [Commented] (CAMEL-8570) NullPointerException when using CXF-component in a spring-boot application with loglevel >= INFO
Date Wed, 01 Apr 2015 00:24:54 GMT


Jakob Thun commented on CAMEL-8570:

Tried with camel 2.16-SNAPSHOT and the defect shown by my example works with that version.
I also noticed that it was enough to set _camel-spring-boot_ to _2.16-SNAPSHOT_, so I guess
the fix is somewhere in that component.

While looking for a solution I saw this [commit discussion|]
in camel-spring-boot where Henryk seems to be spot on and says he will try to find a solution
for bus-creation to work better with Spring 4: 
You need to refer your custom bus (cxf) in the endpoint URI:
{noformat}from("cxf:/incident?serviceClass=" + IncidentService.class.getName() + "&bus=#cxf"){noformat}

Otherwise Camel will try to create the bus for you. Unfortunately Camel refreshes Spring context
while creating default bus, what collides a little bit with the Spring 4 application lifecycle.

Please try it and let me know how it works. BTW I will use your example as a base for Camel+CXF
tests. *I will also try to make camel-spring-boot and camel-cxf a bit smarter to handle bus
registration nicely.*

It seems like he has already solved it in 2.16-SNAPSHOT. So this defect will be fixed in a
future version, but I'm not sure how we should handle it, should Henryk label it with correct
fix versions or something, or should it just be closed?

> NullPointerException when using CXF-component in a spring-boot application with loglevel
> ------------------------------------------------------------------------------------------------
>                 Key: CAMEL-8570
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-cxf, camel-spring-boot
>    Affects Versions: 2.15.0, 2.15.1
>            Reporter: Jakob Thun
> I get a NullPointerException when using log-level INFO or finer in a spring-boot application
with CXF. 
> The exception is thrown from, where it tries to log how
many routes have been started.
> I have made an example project to reproduce it, it's available here: 
> I have tried with camel version: 2.15.0 & 2.15-SNAPSHOT. Both have the same behaviour.
> +Andrew Block started som analysis:+
> It is running into issues in this code block which is executed at logging level >=
>         if (log.isInfoEnabled()) { 
>             // count how many routes are actually started 
>             int started = 0; 
>             for (Route route : getRoutes()) { 
>                 if (getRouteStatus(route.getId()).isStarted()) { 
>                     started++; 
>                 } 
>             } 
>   "Total " + getRoutes().size() + " routes, of which " + started +
" is started."); 
>   "Apache Camel " + getVersion() + " (CamelContext: " + getName()
+ ") started in " + TimeUtils.printDuration(stopWatch.taken())); 
>         } 
> The exception occurs when the status for the route is pulled from the route service.
It is null and the exception is thrown. The route is initially spun up but then refreshes
when the CXF consumer is initialized. 
> Swapping it to test with a direct consumer does not result in a similar situation and
startup succeeds at all logging level. 
> It appears the route is not being registered with the route service

This message was sent by Atlassian JIRA

View raw message