camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Schuller <b.schul...@fz-juelich.de>
Subject Spring route config involving custom components
Date Mon, 21 Jun 2010 16:08:26 GMT

Hi,

I try to setup a Camel (version 2.3.0) route involving custom components
using Spring. My Spring xml looks like this:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" >
       
       <route>
                <from uri="direct://x"/>
                <to uri="foo://x"/>
     </route>

</camelContext>

where "foo" is referring to a custom component which is auto-registered
using the META-INF/services... approach. The custom component is rather
simple and basically just extends DefaultComponent by creating the correct
type of endpoint.

When starting the context I get an exception [1] saying that the
"camelContext
must be specified". With a default component (say, "mock") things are
working.

What could I be missing?

Thanks in advance for your help, and best regards,
Bernd.



[1] stack trace:

org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route1
at: >>> To[foo://x] <<< in route: Route[[From[direct://x]] -> [To[foo://x
because of camelContext must be specified
        at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1111)
        at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
        at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:665)
        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:274)
        at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
        at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
        at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
        at
wisnetgrid.adapter.connectors.unicore.TestSpringConfig.test1(TestSpringConfig.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> To[foo://x] <<< in route: Route[[From[direct://x]]
->
[To[foo://x because of camelContext must be specified
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:720)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:138)
        at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:545)
        at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1209)
        at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1107)
        at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1037)
        at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
        at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:912)
        at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
        at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
        ... 28 more
Caused by: java.lang.IllegalArgumentException: camelContext must be
specified
        at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:260)
        at
org.apache.camel.processor.SendProcessor.<init>(SendProcessor.java:51)
        at
org.apache.camel.processor.SendProcessor.<init>(SendProcessor.java:55)
        at
org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:58)
        at
org.apache.camel.model.ToDefinition.createProcessor(ToDefinition.java:91)
        at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:365)
        at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:161)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:717)
        ... 38 more

-- 
View this message in context: http://camel.465427.n5.nabble.com/Spring-route-config-involving-custom-components-tp510448p510448.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message