You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Andreas Kuhtz (JIRA)" <ji...@apache.org> on 2009/06/15 13:16:35 UTC
[jira] Created: (CAMEL-1711) Routes are started twice with
webapplication context
Routes are started twice with webapplication context
----------------------------------------------------
Key: CAMEL-1711
URL: https://issues.apache.org/activemq/browse/CAMEL-1711
Project: Apache Camel
Issue Type: Bug
Components: camel-spring
Affects Versions: 1.6.1
Environment: WinXP
Reporter: Andreas Kuhtz
Fix For: 1.6.2
I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
The root web application context is started:
{noformat}
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
....
2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
....
2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
...
{noformat}
And now the web application context for the servlet is started:
{noformat}
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
{noformat}
The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
{code:title=DefaultCamelContext.java|borderStyle=solid}
public void start() throws Exception {
super.start();
// the context is now considered started (i.e. isStarted() == true))
// starting routes is done after, not during context startup
synchronized (this) {
startRoutes(routes);
}
LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
}
{code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Kuhtz updated CAMEL-1711:
---------------------------------
Description:
I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
The root web application context is started:
{noformat}
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
....
2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
....
2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
...
{noformat}
And now the web application context for the servlet is started:
{noformat}
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
{noformat}
The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
{code:title=DefaultCamelContext.java|borderStyle=solid}
public void start() throws Exception {
super.start();
// the context is now considered started (i.e. isStarted() == true))
// starting routes is done after, not during context startup
synchronized (this) {
startRoutes(routes);
}
LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
}
{code}
My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
was:
I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
The root web application context is started:
{noformat}
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
....
2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
....
2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
...
{noformat}
And now the web application context for the servlet is started:
{noformat}
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
{noformat}
The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
{code:title=DefaultCamelContext.java|borderStyle=solid}
public void start() throws Exception {
super.start();
// the context is now considered started (i.e. isStarted() == true))
// starting routes is done after, not during context startup
synchronized (this) {
startRoutes(routes);
}
LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
}
{code}
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Fix For: 1.6.2
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-1711.
--------------------------------
Resolution: Fixed
1.x: 785578.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Kuhtz updated CAMEL-1711:
---------------------------------
Attachment: camelspringproblem-server-web.log
The logfile that contains the messages that are referenced in the description
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Fix For: 1.6.2
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52315#action_52315 ]
Andreas Kuhtz commented on CAMEL-1711:
--------------------------------------
Currently building trunk ...
But one thing that I've already seen: The {{doStart()}} calls {{maybeDoStart()}} that checks {{getShouldStartContext()}} and this prevents the camel context to
be started from another bean calling the {{start()}} on the camel context (Our usecase: We use camel on a richclient and must wait for the user to login before the camel context can be started. Therefore we have a bean that listens on a special event to start the camel context) if the {{shouldStartContext}} flag is set to false.
If {{doStart()}} would just be
{code}
protected void doStart() throws Exception {
super.doStart();
if (eventEndpoint == null) {
eventEndpoint = createEventEndpoint();
}
}
{code}
this would work.
I'm not sure if this additional check in {{doStart()}} is needed in other cases but I haven't seen any reason....
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-1711:
-------------------------------
Fix Version/s: 2.0.0
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Kuhtz updated CAMEL-1711:
---------------------------------
Attachment: camel-spring-problem.zip
Sample project
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Fix For: 1.6.2
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52292#action_52292 ]
Claus Ibsen commented on CAMEL-1711:
------------------------------------
We had another Camel user report this on user forum.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Work started: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on CAMEL-1711 started by Claus Ibsen.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Martin Gilday (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52784#action_52784 ]
Martin Gilday commented on CAMEL-1711:
--------------------------------------
We found this issue too. Running against the latest CI build of 1.6.x does seem to fix the problem.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Martin Gilday (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52788#action_52788 ]
Martin Gilday commented on CAMEL-1711:
--------------------------------------
Claus, we took a build from the Camel Hudson server (a problem with our corporate Maven proxy is preventing Camel building). We've been running off it for most of this week and it seems fine.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52787#action_52787 ]
Claus Ibsen commented on CAMEL-1711:
------------------------------------
Martin can you download and build from the source locally. The Apache maven repo for SNAPSHOTS can get ***** and return old .jars.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52312#action_52312 ]
Claus Ibsen commented on CAMEL-1711:
------------------------------------
trunk: 785564.
Andreas could you give it a test? You could grap the source and build yourself or wait for a SNAPSHOT to be deployed to the apache maven snapshot repo
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hadrian Zbarcea updated CAMEL-1711:
-----------------------------------
Fix Version/s: (was: 2.0.0)
2.0-M3
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0-M3
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-1711:
----------------------------------
Assignee: Claus Ibsen
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52308#action_52308 ]
Claus Ibsen commented on CAMEL-1711:
------------------------------------
Andreas are you using CXF with your project?
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52333#action_52333 ]
Andreas Kuhtz commented on CAMEL-1711:
--------------------------------------
Claus, the fix works fine for me. However I think my comment (06:07 AM) about the {{doStart()}} method above should be added.
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-1711:
-------------------------------
Priority: Critical (was: Major)
Affects Version/s: 2.0-M2
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-1711) Routes are started twice with
webapplication context
Posted by "Andreas Kuhtz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52309#action_52309 ]
Andreas Kuhtz commented on CAMEL-1711:
--------------------------------------
The sample project does not contain CXF and the problem exists (... in my real project I use CXF ...).
> Routes are started twice with webapplication context
> ----------------------------------------------------
>
> Key: CAMEL-1711
> URL: https://issues.apache.org/activemq/browse/CAMEL-1711
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.6.1, 2.0-M2
> Environment: WinXP
> Reporter: Andreas Kuhtz
> Assignee: Claus Ibsen
> Priority: Critical
> Fix For: 1.6.2, 2.0.0
>
> Attachments: camel-spring-problem.zip, camelspringproblem-server-web.log
>
>
> I've a spring based web application that has 2 applicationContexts (the second has the first as parent). My problem is that the SpringCamelContext listens to the ContextRefreshedEvent and starts the camel context.
> This works fine if you have only 1 context but if the ContextRefreshedEvent of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in ServiceSupport) but I think the the startRoutes() in the start()-method of DefaultCamelContext should also prevent to be called twice...
> See discussion here [http://www.nabble.com/How-to-prevent-routes-from-started-twice--td23983653.html]
> Attached is a test-project. The core project simply defines a service that is exported in the web project. The applicationContext-services.xml creates the camelContext and the DispatcherServlet is used to export the service as remoteService.
> Start the webapp with the jetty-run.cmd in the web project. The logfile is created in the web project.
> The root web application context is started:
> {noformat}
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a: \
> display name [Root WebApplicationContext]; startup date [Mon Jun 15 11:43:22 CEST 2009]; root of context hierarchy]
> 2009-06-15 11:43:24.771 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:24.771 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) is starting
> ....
> 2009-06-15 11:43:25.245 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> ....
> 2009-06-15 11:43:25.372 INFO [main][org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 2420 ms
> 2009-06-15 11:43:25.435 INFO [main][/camel-spring-problem-web] - Initializing Spring FrameworkServlet 'CamelSpringProblem'
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization started
> 2009-06-15 11:43:25.435 INFO [main][org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; parent: \
> org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a
> ...
> {noformat}
> And now the web application context for the servlet is started:
> {noformat}
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Publishing spring-event: \
> org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@1ccbdf7: \
> display name [WebApplicationContext for namespace 'CamelSpringProblem-servlet']; startup date [Mon Jun 15 11:43:25 CEST 2009]; \
> parent: org.springframework.web.context.support.XmlWebApplicationContext@1d4e49a]
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.spring.SpringCamelContext] - Starting the CamelContext now that the ApplicationContext has started
> 2009-06-15 11:43:25.530 DEBUG [main][org.apache.camel.management.DefaultInstrumentationAgent] - Registered MBean with objectname: \
> org.apache.camel:context=chaw389c/camel-amq,type=consumers,name=JmsConsumer(0x14bcb5c)
> 2009-06-15 11:43:25.530 INFO [main][org.apache.camel.impl.DefaultCamelContext] - Apache Camel 1.6.1 (CamelContext:camel-amq) started
> 2009-06-15 11:43:25.530 INFO [main][org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'CamelSpringProblem': initialization completed in 95 ms
> {noformat}
> The ContextRefreshedEvent is published and causes the SpringCamelContext to handle the event and try to start the camel context again. But the start() in DefaultCamelContext calls super.start() and ServiceSupport detects correctly that the context is already started and does nothing but the call to startRoutes(...) is executed and this should no happen.
> {code:title=DefaultCamelContext.java|borderStyle=solid}
> public void start() throws Exception {
> super.start();
>
> // the context is now considered started (i.e. isStarted() == true))
> // starting routes is done after, not during context startup
> synchronized (this) {
> startRoutes(routes);
> }
> LOG.info("Apache Camel " + getVersion() + " (CamelContext:" + getName() + ") started");
> }
> {code}
> My favorite solution would be to add a flag that would prevent the camel context to be started from the ContextRefreshed event but allows to start the context manually from another user defined bean (possible by calling the start() method on SpringCamelContext. The shouldStartContext blocks both ways if set to false.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.