[ 
https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=48362#action_48362
 ] 

Claus Ibsen commented on CAMEL-1205:
------------------------------------

{code}

java.lang.IllegalStateException: Failed to load ApplicationContext
        at 
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:201)
        at 
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
        at 
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
        at 
org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
        at 
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runBare(AbstractJUnit38SpringContextTests.java:183)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found 
for: ref:file://target/antpathmatcher?consumer.recursive=true&filter=#myFilter, 
please check your classpath contains the needed camel component jar.
        at 
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:120)
        at org.apache.camel.model.FromType.resolveEndpoint(FromType.java:72)
        at 
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:81)
        at org.apache.camel.model.RouteType.addRoutes(RouteType.java:239)
        at org.apache.camel.model.RouteType.addRoutes(RouteType.java:86)
        at 
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:660)
        at 
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:650)
        at 
org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:167)
        at 
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:162)
        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
        at 
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:97)
        at 
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:116)
        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.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
        at 
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
        at 
org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
        at 
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:197)
        ... 21 more
{code}

> @EndpointInject can not lookup bean if endpoint is defined directly as a 
> consumer (from)
> ----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1205
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1205
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.1, 2.0.0
>            Reporter: Claus Ibsen
>            Priority: Minor
>
> I was messing with camel-spring and routes using spring DSL
> I had this part of unit test code
> {code:java}
>     @EndpointInject(name = "myFileEndpoint")
>     protected Endpoint inputFile;
> {code}
> To lookup an endppoint with the given name *myFileEndpoint*
> But if I define it directly then it cannot be found
> {code:xml}
>         <route>
>             <from id="myFileEndpoint" 
> uri="file://target/antpathmatcher?consumer.recursive=true&amp;filter=#myFilter"/>
>             <to uri="mock:result"/>
>         </route>
> {code}
> So I have to define it as a loose endpoint as:
> {code:xml}
>         <endpoint id="myFileEndpoint" 
> uri="file://target/antpathmatcher?consumer.recursive=true&amp;filter=#myFilter"/>
>         <route>
>             <from ref="myFileEndpoint"/>
>             <to uri="mock:result"/>
>         </route>
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to