Hi Nicolas,
There is some sort of cyclic dependency in your code from the CDI standpoint.
You have an injection point for @Uri("jms:...") while your have the producer
method for the component in the same bean.
I would suggest you either move the producer method in a separate bean, like
JmsComponentFactory or declare the producer method static.
Antonin
> On 25 Apr 2016, at 14:46, nicolasduminil
> <[email protected]> wrote:
>
> Hi Claus,
>
> Many thanks for your suggestion. Now the code looks as follows:
>
> public class MyRoutes extends RouteBuilder {
> @Inject
> @Uri("file:data/inbox?noop=true")
> private Endpoint inputEndpoint;
>
> @Inject
> @Uri("jms:incommingData")
> private Endpoint resultEndpoint;
>
> @Produces
> @Named("jms")
> public Component jmsComponent()
> {
> ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("tcp://cac40:61616?create=false");
> return JmsComponent.jmsComponentAutoAcknowledge(connectionFactory);
> }
>
> @Override
> public void configure() {
> from(inputEndpoint).to("bean:counterBean").to(resultEndpoint);
> }
> }
>
> Running it with camel:run raises the following:
>
> [ERROR] Caused by: org.apache.camel.ResolveEndpointFailedException: Failed
> to resolve endpoint: jms://incommingData due to: Cannot auto create
> component: jms
> [ERROR] at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:588)
> [ERROR] at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:601)
> [ERROR] at
> org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.getEndpoint(Unknown
> Source)
> [ERROR] at
> org.apache.camel.cdi.CdiCamelFactory.endpoint(CdiCamelFactory.java:119)
> [ERROR] ... 65 more
>
> Is there anything else I could try. This code was generated by the
> maven-camel-jms-cdi archetype.
>
> Kind regards,
>
> Nicolas DUMINIL
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/java-lang-IllegalArgumentException-Cannot-add-component-as-its-already-previously-added-jms-tp5781607p5781658.html
> Sent from the Camel - Users mailing list archive at Nabble.com.