Thanks for your pointer Willem. It worked with version 2.7.5. May be we
could have this information available in wiki so that it saves someone
grief.
I already wrote an implementation to have it work in 2.4.0. Here is the
outline of the solution just in case it helps someone who couldn't upgrade.
Basically I did not register servlet:/// route through the context listener
but manually through spring application context event. This is called after
web application context is initialized.
Here is the registrar:
public class ServletComponentRegistrar implements
ApplicationListener<ContextRefreshedEvent>, CamelContextAware {
CamelContext camelContext;
public MyService() {
super();
System.out.println("Application context listener is created!");
}
public void service() throws Exception {
if (camelContext != null) {
try {
camelContext.addRoutes(new
ServletComponentRoute());
} catch (IllegalArgumentException e) {
System.out.println("Exception is expected.
Servlet component is not
initialized yet. Waiting for next refresh of spring container " +
e.getMessage());
}
}
}
@Override
public void onApplicationEvent(ContextRefreshedEvent event) throws
Exception {
if (camelContext != null) {
try {
camelContext.addRoutes(new MyRoute());
} catch (IllegalArgumentException e) {
System.out.println("Exception is expected.
Servlet component is not
initialized yet. Waiting for next refresh of spring container " +
e.getMessage());
}
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-and-Tomcat-tp3386793p5568617.html
Sent from the Camel - Users mailing list archive at Nabble.com.