camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Using camel without spring
Date Mon, 08 Dec 2014 02:11:03 GMT
OK, I know you point, you need to setup the camel registry for lookup the processor reference.
Please take a look at the section of "Using custom CamelContextLifecycle"[1], there is an
example to show you how to setup the registry for processor reference that you may use.

I will update the example for this usage shortly.

[1]https://camel.apache.org/servletlistener-component.html

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 8, 2014 at 9:31:29 AM, yogu13 (yogesh.rao@synechron.com) wrote:
> Thanks for the quick reply williem!
>  
> my configuration used is as follows:
>  
> web.xml
>  
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
> http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
> version="3.1">
>  
> Application
>  
>  
>  
> name
> MyCamel
>  
>  
>  
>  
> routeBuilder-MyRoute
>  
>  
> classpath:camel-config.xml
>  
>  
>  
>  
>  
> org.apache.camel.component.servletlistener.JndiCamelServletContextListener  
>  
>  
>  
>  
> CamelServlet
>  
> org.apache.camel.component.servlet.CamelHttpTransportServlet  
> 1
>  
>  
>  
>  
> CamelServlet
> /camel/*
>  
>  
>  
>  
>  
> camel-config.xml :
>  
>  
>  
>  
> > class="com.example.processor.BackEndServicesDiscoveryProcessor"/>
>  
>  
>  
>  
>  
>  
>
name

>  
>  
> Hello ${header.name} how are you?
>  
>  
>  
>  
>  
> Add a name parameter to uri, eg ?name=foo
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
> Hi ${header.paymentType}
>  
>  
>  
>  
>  
> The processor written implements org.apache.camel.Processor interface.
>  
> The exception seen at startup of the server is as follows
>  
> SEVERE: Exception sending context initialized event to listener instance of
> class
> org.apache.camel.component.servletlistener.JndiCamelServletContextListener  
> java.lang.RuntimeException: Error starting CamelContext.
> at
> org.apache.camel.component.servletlistener.CamelServletContextListener.contextInitialized(CamelServletContextListener.java:190)
 
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4772)  
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)  
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)  
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)  
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
> at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
> route route2 at: >>> process[ref:myProcessor] <<< in route:
> Route(route2)[[From[rest:///get:payment/{paymentType}]] -> [... because of
> No bean could be found in the registry for: myProcessor of type:
> org.apache.camel.Processor
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945)  
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187)  
> at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:794)  
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2184)
 
> at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1916)
 
> at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1777)  
> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)  
> at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1745)  
> at
> org.apache.camel.component.servletlistener.CamelServletContextListener.contextInitialized(CamelServletContextListener.java:184)
 
> ... 9 more
> Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in
> the registry for: myProcessor of type: org.apache.camel.Processor
> at
> org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:151)
 
> at
> org.apache.camel.impl.DefaultRouteContext.mandatoryLookup(DefaultRouteContext.java:144)
 
> at
> org.apache.camel.model.ProcessDefinition.createProcessor(ProcessDefinition.java:91) 

> at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:500)
 
> at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)  
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:942)  
> ... 17 more
>  
>  
> camel version is 2.14
>  
> Regards,
> -Yogesh
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-camel-without-spring-tp5760251p5760259.html
 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Mime
View raw message