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

Claus Ibsen updated CAMEL-15682:
--------------------------------
    Fix Version/s: 3.4.5
                   3.6.0

> Aggregate route recovery fails to start up
> ------------------------------------------
>
>                 Key: CAMEL-15682
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15682
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.4.2, 3.5.0
>         Environment: * Apache Camel 3.4.2
>  * Spring Boot 2.3.4.RELEASE
>  * Postgres database as an aggregate repository
>            Reporter: David Borsos
>            Priority: Major
>             Fix For: 3.6.0, 3.4.5
>
>
> Hello,
> We've recently had an outage in one of our applications built using Apache 
> Camel and specifically using a JDBC-based aggregation on one route.
> After an unclean exit, the application continued to fail to start up.
> The only way for us to recover from this situation was to erase the contents 
> of the aggregate repository and recover the lost data manually. Until we 
> executed that, the application was completely offline (this error resulted in 
> a failure that exited the whole JVM)
> The error we observed during startup:
> {code}
> org.apache.camel.FailedToStartRouteException: Failed to start route 
> event.aggregator because of null
>       at 
> org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:125)
>       at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:263)
>       at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:156)
>       at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:114)
>       at 
> org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2809)
>       at 
> org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2657)
>       at 
> org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2620)
>       at 
> org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:43)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:115)
>       at 
> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2452)
>       at 
> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
>       at 
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:157)
>       at 
> org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
>       at 
> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
>       at 
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
>       at 
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
>       at 
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
>       at 
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898)
>       at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554)
>       at 
> org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
>       at 
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
>       at 
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
>       at 
> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
>       at 
> org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
>       at 
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
>       at 
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
>       at 
> com.winnowsolutions.vision.annotation.app.MainApplication.main(MainApplication.java:25)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>       at 
> org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
>       at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
>       at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
>       at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
> Caused by: org.apache.camel.RuntimeCamelException: 
> java.lang.ClassCastException: class java.lang.Integer cannot be cast to class 
> java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base 
> of loader 'bootstrap')
>       at 
> org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:52)
>       at 
> org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:67)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:101)
>       at 
> org.apache.camel.processor.channel.DefaultChannel.doStart(DefaultChannel.java:143)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:115)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:87)
>       at org.apache.camel.processor.Pipeline.doStart(Pipeline.java:154)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:115)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
>       at 
> org.apache.camel.support.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:115)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
>       at 
> org.apache.camel.impl.engine.RouteService.startChildService(RouteService.java:334)
>       at 
> org.apache.camel.impl.engine.RouteService.doWarmUp(RouteService.java:184)
>       at 
> org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
>       ... 34 common frames omitted
> Caused by: java.lang.ClassCastException: class java.lang.Integer cannot be 
> cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in 
> module java.base of loader 'bootstrap')
>       at 
> org.apache.camel.processor.aggregate.AggregateProcessor.restoreTimeoutMapFromAggregationRepository(AggregateProcessor.java:894)
>       at 
> org.apache.camel.processor.aggregate.AggregateProcessor.doStart(AggregateProcessor.java:1532)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:115)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
>       at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:101)
>       at 
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1459)
>       at 
> org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:60)
>       ... 49 common frames omitted
> {code}
> After some investigation we have identified that the error is sourced from 
> the way Camel is defaulting certain values when recovering the aggregate 
> contents from the repository; specifically:
> https://github.com/apache/camel/blob/camel-3.4.2/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java#L894
> {code:java}
> long timeout = exchange.hasProperties() ? 
> exchange.getProperty(Exchange.AGGREGATED_TIMEOUT, 0, long.class) : 0;
> {code}
> This code is problematic if the branch that gets executed is the one where 
> the default {{0}} (Integer) value is attempted to be cast to the target 
> {{long}} variable.
> Please correct the defaulting outlined in the code above so that it defaults 
> with the correct (Long) type. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to