I add camel-servlet to pom.xml and in the camel-context.xml, I added: <bean id="servlet" class="org.apache.camel.component.servlet.ServletComponent"> <property name="camelContext" ref="camel" /> </bean>
However, I still get the following error when starting Tomcat. SEVERE: Context initialization failed org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Can't find the deployied servlet, please set the ServletComponent with it or delopy a CamelHttpTransportServlet int the web container at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1011) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121) at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:461) at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:275) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:737) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) willem.jiang wrote: > > Hi, > > You need to include the camel-servlet jar which is not a part of > camel-http module and the camel-servlet component is a new component for > camel 2.0 M3. > > I will update the wiki page for it. > > Willem > > janylj wrote: >> >> >> janylj wrote: >>> >>> The camel-context.xml has: >>> >>> <!-- create a camel context as to start Camel --> >>> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> >>> <package>package.has.routebuilderl</package> >>> </camelContext> >>> <bean id="servlet" >>> class="org.apache.camel.component.http.HttpComponent"> >>> <property name="camelContext" ref="camel" /> >>> </bean> >>> >>> >> >> I figure that I should not have a HttpComponent for servlet scheme >> because >> HttpComponent is only for output data. Then what component I should set >> for >> servlet. If I delete HttpComponent part, Tomat has error. >> >> SEVERE: Context initialization failed >> org.apache.camel.ResolveEndpointFailedException: Failed to resolve >> endpoint: >> servlet:///hello due to: No component found with scheme: servlet >> at >> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:411) >> > > > -- View this message in context: http://www.nabble.com/How-to-create-a-Servlet-component--tp24909157p24909831.html Sent from the Camel - Users mailing list archive at Nabble.com.