You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Magnus Heino <ma...@filur.org> on 2008/03/05 14:12:09 UTC
@EndpointInject in SpringRouterBuilder
Whats wrong with this?
@Component
public class ServiceRoutes extends SpringRouteBuilder {
@EndpointInject
protected Endpoint<?> updateService;
public void configure() throws Exception() {
Endpoint<?> myUpdateService = (Endpoint<?>) this.getContext
().getRegistry().lookup("updateService");
}
}
myUpdateService is successfully looked up, but the @EndpointInject fails
with:
java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified
on: org.apache.camel.impl.RouteContext@17b4703
at org.apache.camel.impl.RouteContext.resolveEndpoint(RouteContext.java
:117)
at org.apache.camel.model.ToType.resolveEndpoint(ToType.java:80)
at org.apache.camel.model.ToType.createProcessor(ToType.java:74)
at org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java
:1205)
at org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:91)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:177)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:71)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(
DefaultCamelContext.java:466)
at org.apache.camel.impl.DefaultCamelContext.doStart(
DefaultCamelContext.java:458)
at org.apache.camel.spring.SpringCamelContext.doStart(
SpringCamelContext.java:143)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(
SpringCamelContext.java:96)
--
/Magnus Heino
Re: @EndpointInject in SpringRouterBuilder
Posted by James Strachan <ja...@gmail.com>.
On 05/03/2008, Magnus Heino <ma...@filur.org> wrote:
> Ok, I was interpreting the error msg wrong. Configure is called before
> @EndpointInject is injected, so updateService is null when configure is
> called.
>
> Is this a feature or bug? It would be nice to be able to use @EndpointInject
> in RouteBuilders, instead of the more verbose explicit lookup.
FWIW @EndpointInject is called before the configure when not using the
@Component approach (e.g. putting the bean in the XML). Am sure
there's a way to fix this; looks like some kinda bug when using
@Component.
I've raised a JIRA to track this...
https://issues.apache.org/activemq/browse/CAMEL-361
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com
Re: @EndpointInject in SpringRouterBuilder
Posted by Magnus Heino <ma...@filur.org>.
Ok, I was interpreting the error msg wrong. Configure is called before
@EndpointInject is injected, so updateService is null when configure is
called.
Is this a feature or bug? It would be nice to be able to use @EndpointInject
in RouteBuilders, instead of the more verbose explicit lookup.
/Magnus
On Wed, Mar 5, 2008 at 2:12 PM, Magnus Heino <ma...@filur.org> wrote:
>
> Whats wrong with this?
>
> @Component
> public class ServiceRoutes extends SpringRouteBuilder {
>
> @EndpointInject
> protected Endpoint<?> updateService;
>
> public void configure() throws Exception() {
> Endpoint<?> myUpdateService = (Endpoint<?>) this.getContext
> ().getRegistry().lookup("updateService");
> }
> }
>
>
> myUpdateService is successfully looked up, but the @EndpointInject fails
> with:
>
> java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be
> specified on: org.apache.camel.impl.RouteContext@17b4703
> at org.apache.camel.impl.RouteContext.resolveEndpoint(
> RouteContext.java:117)
> at org.apache.camel.model.ToType.resolveEndpoint(ToType.java:80)
> at org.apache.camel.model.ToType.createProcessor(ToType.java:74)
> at org.apache.camel.model.ProcessorType.makeProcessor(
> ProcessorType.java:1205)
> at org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java
> :91)
> at org.apache.camel.model.RouteType.addRoutes(RouteType.java:177)
> at org.apache.camel.model.RouteType.addRoutes(RouteType.java:71)
> at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(
> DefaultCamelContext.java:466)
> at org.apache.camel.impl.DefaultCamelContext.doStart(
> DefaultCamelContext.java:458)
> at org.apache.camel.spring.SpringCamelContext.doStart(
> SpringCamelContext.java:143)
> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
> at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(
> SpringCamelContext.java:96)
>
>
> --
>
> /Magnus Heino
--
/Magnus Heino