You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Vladimir Romaniuk (JIRA)" <ji...@apache.org> on 2015/12/02 12:29:11 UTC

[jira] [Comment Edited] (CAMEL-9383) ConcurrentModificationException on running Camel via Main class

    [ https://issues.apache.org/jira/browse/CAMEL-9383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035667#comment-15035667 ] 

Vladimir Romaniuk edited comment on CAMEL-9383 at 12/2/15 11:28 AM:
--------------------------------------------------------------------

I idenify the root of problem. I have a custom component which includes RouteBuilder and injecting new route to the context and this custom component in the route. So when the route with custom component is starting new route from custom component injecting and affecting this part of code in DefaultCamelContext:
    protected void startRouteDefinitions(Collection<RouteDefinition> list) throws Exception {
        if (list != null) {
            for (RouteDefinition route : list) {
                startRoute(route);
            }
        }
    }
So seems new route can't be added in runtime via RouteBuilder in the same context.


was (Author: vromaniuk):
I idenify the root of problem. I have a custom component which includes RouteBuilder and injecting new route to the context and this custom component in the route. So when the route with custom component is starting new route from component injecting and affecting this part of code in DefaultCamelContext:
    protected void startRouteDefinitions(Collection<RouteDefinition> list) throws Exception {
        if (list != null) {
            for (RouteDefinition route : list) {
                startRoute(route);
            }
        }
    }
So seems new route can't be added in runtime via RouteBuilder in the same context.

> ConcurrentModificationException on running Camel via Main class
> ---------------------------------------------------------------
>
>                 Key: CAMEL-9383
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9383
>             Project: Camel
>          Issue Type: Bug
>         Environment: MacOS X 10.10.5
> Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
>            Reporter: Vladimir Romaniuk
>             Fix For: 2.16.1
>
>
> 2015-12-01 15:48:05,449 [main           ] INFO  o.a.c.s.SpringCamelContext     -            -            - Apache Camel 2.16.1 (CamelContext: hl7-requestor_context) is shutdown in 0.005 seconds
> Exception in thread "main" org.apache.camel.RuntimeCamelException: java.util.ConcurrentModificationException
>         at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
>         at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:138)
>         at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:340)
>         at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
>         at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
>         at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
>         at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:775)
>         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
>         at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
>         at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:94)
>         at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:205)
>         at org.apache.camel.spring.Main.doStart(Main.java:154)
>         at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>         at org.apache.camel.main.MainSupport.run(MainSupport.java:124)
>         at org.apache.camel.main.MainSupport.run(MainSupport.java:343)
>         at org.apache.camel.spring.Main.main(Main.java:87)
> Caused by: java.util.ConcurrentModificationException
>         at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
>         at java.util.ArrayList$Itr.next(ArrayList.java:831)
>         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3257)
>         at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2981)
>         at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
>         at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2812)
>         at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2808)
>         at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2831)
>         at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2808)
>         at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>         at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2777)
>         at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:270)
>         at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:136)
>         ... 14 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)