Hi, It looks like you are using camel spring Main to load the camel application context. I'm not sure why your mvn project have the dependency of camel-archetype-spring:jar:1.0-SNAPSHOT. -- Willem Jiang
Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Thursday, October 18, 2012 at 8:54 PM, Robert wrote: > Hi, > > camel can't find the context component [1] in my application. My application > is based on the Camel java maven archetype. I am declaring the camel-context > maven dependency. What am I doing wrong? > > Here is my route declaration > > <camel:camelContext> > <camel:route> > <camel:from uri="jetty:http://localhost:9090/foo"/> > <camel:to uri="context:fooCamelContext:foo.in (http://foo.in)"/> > </camel:route> > </camel:camelContext> > > <camel:camelContext id="fooCamelContext" streamCache="true" > xmlns="http://camel.apache.org/schema/spring"> > <camel:route> > <camel:from uri="direct:foo.in (http://foo.in)"/> > <camel:to uri="log:local.com.foo"/> > </camel:route> > </camel:camelContext> > > The error message during startup (using mvn:run): > > [pache.camel.spring.Main.main()] MainSupport INFO Apache > Camel 2.10.1 stopping > ************************************* > Error occurred while running main from: org.apache.camel.spring.Main > java.lang.reflect.InvocationTargetException > 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:597) > at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:440) > at java.lang.Thread.run(Thread.java:662) > Caused by: org.apache.camel.RuntimeCamelException: > org.apache.camel.FailedToCreateRouteException: Failed to create route route1 > at: >>> To[context:fooCamelContext:foo.in (http://foo.in)] <<< in route: > Route[[From[jetty:http://localhost:9090/foo]] -> [To[context... because of > Failed to resolve endpoint: context://fooCamelContext:foo.in (http://foo.in) > due to: No > component found with scheme: context > at > org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280) > [...] > > > My maven dependencies (using mvn dependency:tree and the camel java maven > archetype). Look for the line marked "->": > > [INFO] Scanning for projects... > [INFO] > [INFO] > ------------------------------------------------------------------------ > [INFO] Building A Camel Spring Route 1.0-SNAPSHOT > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ > camel-archetype-spring --- > [INFO] > org.apache.camel.archetypes:camel-archetype-spring:jar:1.0-SNAPSHOT > [INFO] +- org.apache.camel:camel-core:jar:2.10.1:compile > [INFO] +- org.apache.camel:camel-spring:jar:2.10.1:compile > [INFO] | +- > org.springframework:spring-context:jar:3.0.7.RELEASE:compile > [INFO] | | +- > org.springframework:spring-beans:jar:3.0.7.RELEASE:compile > [INFO] | | +- > org.springframework:spring-core:jar:3.0.7.RELEASE:compile > [INFO] | | +- > org.springframework:spring-expression:jar:3.0.7.RELEASE:compile > [INFO] | | \- org.springframework:spring-asm:jar:3.0.7.RELEASE:compile > [INFO] | +- org.springframework:spring-aop:jar:3.0.7.RELEASE:compile > [INFO] | | \- aopalliance:aopalliance:jar:1.0:compile > [INFO] | \- org.springframework:spring-tx:jar:3.0.7.RELEASE:compile > [INFO] +- org.apache.camel:camel-http:jar:2.10.1:compile > [INFO] | +- > org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.1.2:compile > [INFO] | +- commons-httpclient:commons-httpclient:jar:3.1:compile > [INFO] | | \- commons-logging:commons-logging:jar:1.0.4:compile > [INFO] | \- commons-codec:commons-codec:jar:1.6:compile > [INFO] +- org.apache.camel:camel-jetty:jar:2.10.1:compile > [INFO] | +- org.eclipse.jetty:jetty-server:jar:7.5.4.v20111024:compile > [INFO] | | +- javax.servlet:servlet-api:jar:2.5:compile > [INFO] | | +- > org.eclipse.jetty:jetty-continuation:jar:7.5.4.v20111024:compile > [INFO] | | \- org.eclipse.jetty:jetty-http:jar:7.5.4.v20111024:compile > [INFO] | | \- > org.eclipse.jetty:jetty-io:jar:7.5.4.v20111024:compile > [INFO] | +- > org.eclipse.jetty:jetty-security:jar:7.5.4.v20111024:compile > [INFO] | +- org.eclipse.jetty:jetty-servlet:jar:7.5.4.v20111024:compile > [INFO] | +- > org.eclipse.jetty:jetty-servlets:jar:7.5.4.v20111024:compile > [INFO] | | \- org.eclipse.jetty:jetty-util:jar:7.5.4.v20111024:compile > [INFO] | +- org.eclipse.jetty:jetty-client:jar:7.5.4.v20111024:compile > [INFO] | \- org.eclipse.jetty:jetty-jmx:jar:7.5.4.v20111024:compile > -> [INFO] +- org.apache.camel:camel-context:jar:2.10.1:compile > [INFO] +- org.slf4j:slf4j-api:jar:1.6.6:compile > [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.6:compile > [INFO] +- log4j:log4j:jar:1.2.17:compile > [INFO] \- org.apache.camel:camel-test-spring:jar:2.10.1:test > [INFO] +- org.apache.camel:camel-test:jar:2.10.1:test > [INFO] | \- junit:junit:jar:4.10:test > [INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:test > [INFO] \- org.springframework:spring-test:jar:3.1.1.RELEASE:test > [INFO] > ------------------------------------------------------------------------ > > I created a new thread for this question since my last post is only somewhat > related... > > Thanks in advance, > Robert > > ---- > [1] http://camel.apache.org/context.html > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Context-component-not-found-during-build-tp5721236.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).