You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2008/12/29 10:33:05 UTC

[jira] Created: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

@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.


[jira] Assigned: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1205:
----------------------------------

    Assignee: Claus Ibsen

> @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.6.0, 2.0.0
>            Reporter: Claus Ibsen
>            Assignee: 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.


[jira] Resolved: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1205.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

Committed revision 743010.

> @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.6.0, 2.0.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> 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.


[jira] Updated: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1205:
-------------------------------

    Comment: was deleted

> @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.


[jira] Commented: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=48367#action_48367 ] 

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

This is the correct stacktrace

{code}
java.lang.IllegalArgumentException: registry entry called myFileEndpoint of type org.apache.camel.Endpoint must be specified
	at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:168)
	at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:174)
	at org.apache.camel.util.CamelContextHelper.getEndpointInjection(CamelContextHelper.java:219)
	at org.apache.camel.impl.CamelPostProcessorHelper.getEndpointInjection(CamelPostProcessorHelper.java:120)
	at org.apache.camel.impl.CamelPostProcessorHelper.getInjectionValue(CamelPostProcessorHelper.java:132)
	at org.apache.camel.spring.CamelBeanPostProcessor.injectField(CamelBeanPostProcessor.java:143)
	at org.apache.camel.spring.CamelBeanPostProcessor$2.doWith(CamelBeanPostProcessor.java:132)
	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:523)
	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)
	at org.apache.camel.spring.CamelBeanPostProcessor.injectFields(CamelBeanPostProcessor.java:128)
	at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:76)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:341)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:111)
	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)
{code}

On this unit test
{code:java}
@ContextConfiguration
public class SpringFileAntPathMatcherFilterTest extends AbstractJUnit38SpringContextTests {
    protected String expectedBody = "Godday World";
    @Autowired
    protected ProducerTemplate template;
    @EndpointInject(name = "myFileEndpoint")
    protected Endpoint inputFile;
    @EndpointInject(uri = "mock:result")
    protected MockEndpoint result;

    public void testAntPatchMatherFilter() throws Exception {
        result.expectedBodiesReceived(expectedBody);

        template.sendBodyAndHeader(inputFile, "Hello World", FileComponent.HEADER_FILE_NAME, "hello.txt");
        template.sendBodyAndHeader(inputFile, "Bye World", FileComponent.HEADER_FILE_NAME, "bye.xml");
        template.sendBodyAndHeader(inputFile, expectedBody, FileComponent.HEADER_FILE_NAME, "subfolder/godday.txt");

        result.assertIsSatisfied();
    }

    @Override
    protected void setUp() throws Exception {
        TestSupport.deleteDirectory("target/antpathmatcher");
        super.setUp();
    }
}
{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.


[jira] Commented: (CAMEL-1205) @EndpointInject can not lookup bean if endpoint is defined directly as a consumer (from)

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ 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.