The ServletComopnent need to locate the CamelHttpTransportServlet when the servlet endpoint is started, maybe you can set the route with notAutoStart, and start the route from the console to workaround the below issue.

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang

Cappa Roberto wrote:
Hi, I've already tried this solution, but if I remove the contextConfigLocation 
init-param, this exception is thrown:

[11:11:04,281 ERROR] ContextLoader.initWebApplicationContext(215) - Context init
ialization failed
org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Cann
ot find the deployed servlet, please configure the ServletComponent or configure
 a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.x
ml
        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHe
lper.java:1111)
        at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringC
amelContext.java:103)
        at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(Ca
melContextFactoryBean.java:665)
        at org.springframework.context.event.SimpleApplicationEventMulticaster$1
.run(SimpleApplicationEventMulticaster.java:78)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut
or.java:49)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.m
ulticastEvent(SimpleApplicationEventMulticaster.java:76)
        at org.springframework.context.support.AbstractApplicationContext.publis
hEvent(AbstractApplicationContext.java:274)
        at org.springframework.context.support.AbstractApplicationContext.finish
Refresh(AbstractApplicationContext.java:736)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:383)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:255)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:199)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:45)
        at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.
java:548)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.jav
a:1239)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466
)
        at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6Plug
inWebAppContext.java:124)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:152)
        at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHan
dlerCollection.java:156)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:152)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
        at org.mortbay.jetty.Server.doStart(Server.java:222)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.
java:132)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMo
jo.java:441)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.
java:383)
        at org.mortbay.jetty.plugin.Jetty6RunWar.execute(Jetty6RunWar.java:67)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:678)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:553)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:523)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:332)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:181)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


Thanks
________________________________________
Da: Willem Jiang [[email protected]]
Inviato: venerdì 2 luglio 2010 9.20
A: [email protected]
Oggetto: Re: Camel web console and "servlet" component

When you use the servlet component, you just need to make sure the
servlet start before the servlet component.

Can you try to keep the sevlet configuration and don't use
contextConfigLocation to specify your camel context ?

Put the camelContext into applicationContext, or modify it within the
web console.

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang

Cappa Roberto wrote:
Hi, I'm trying to create a Camel configuration inside the camel-web war (in order to use 
camel console), with a "from" clause based on SERVLET component. To do this, 
I've added the camel-servlet dependencies in the war and I've added the servlet 
configuration in web.xml. The servlet configuration in web.xml needs 
contextConfigLocation param, and it stars a separate instance of camel context. Now, I'm 
in this situation:

- If I add the servlet configuration, It starts another instance of the camel 
context, and it isn't monitored by the console that is connected to another 
context.

- If I don't add the servlet configuration, I'm unable to use the servlet 
component.

Where I'm wrong?

Thanks.



Reply via email to