You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Maurice <ma...@betzel.net> on 2013/08/18 13:20:54 UTC

Producer template and spring xml defaultendpoint error

Using camel 2.11.0, Karaf 2.3.1. with blueprint.
I am trying to send multiple messages using a custom processor to a
tx-transacted jms endpoint with a ProducerTemplate according to  l
<http://camel.apache.org/how-do-i-write-a-custom-processor-which-sends-multiple-messages.html> 
.
XML:
<template id="stackProducerTemplate"
defaultEndpoint="amq-tx:queue:stackQueue?messageConverter=#byteStreamMessageConverter"
camelContextId="camelContext"/>
(the template is declared within the camelcontext camelContext, but with our
without it does not matter)
The error i get from blueprint on creation of the Template:

org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
validate xml

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
content was found starting with element 'template'. One of
'{"http://camel.apache.org/schema/blueprint":route}' is expected.

Programmatically this works perfect, injecting the camel context in the
processor and instantiating the template from it.



--
View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Producer template and spring xml defaultendpoint error

Posted by Maurice <ma...@betzel.net>.
Violating mailing list ettiquette:

Oh jeze, my closing blueprint tag is missing 

I really appreiciate you answering my questions on a Sunday but i don't want
to force you to, its nice weather here and i should be playing outside. So
to complete the picture, i found out that the bussines case, from the succer
who got himself fired leaving me to solve his crap, does not require me te
produce multiple messages any more. And the xsd version stays in untill i am
finished developing.



--
View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471p5737485.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Producer template and spring xml defaultendpoint error

Posted by Babak Vahdat <ba...@swissonline.ch>.
No, to my knowledge this is NOT complete :-) as you just provide a PARTIAL
snapshot of your Blueprint and then expect people to understand what is
going wrong in your App.

Would you mind to share the whole thing with us, example the </blueprint>
closing tag is missing by your provided config.

Other than that it's a BAD practice to make use of a specific version of a
given XSD (you can google for this to find out why) , so a better approach
would be:

xsi:schemaLocation="http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd"

Babak


Maurice wrote
> To my knowledge this is complete:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cml="http://camel.apache.org/schema/blueprint"
> 	xsi:schemaLocation="http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint-2.11.0.xsd">
> 	
> <camelContext xmlns="http://camel.apache.org/schema/blueprint"
> id="camelContext" depends-on="logService">
> Claus, what do you mean with order? I have the blueprint split-up in
> camel-context, module-context and osgi-context xml files.





--
View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471p5737479.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Producer template and spring xml defaultendpoint error

Posted by Maurice <ma...@betzel.net>.
To my knowledge this is complete:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cml="http://camel.apache.org/schema/blueprint"
	xsi:schemaLocation="http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint-2.11.0.xsd">

	<camelContext xmlns="http://camel.apache.org/schema/blueprint"
id="camelContext" depends-on="logService">

Claus, what do you mean with order? I have the blueprint split-up in
camel-context, module-context and osgi-context xml files.



--
View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471p5737475.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Producer template and spring xml defaultendpoint error

Posted by Claus Ibsen <cl...@gmail.com>.
Make sure the order where you put <template> is correct. You can
validate the XML with the blueprint schema. Most moderns IDEs can do
this for you. Eg in IDEA I just right click -> validate

On Sun, Aug 18, 2013 at 1:20 PM, Maurice <ma...@betzel.net> wrote:
> Using camel 2.11.0, Karaf 2.3.1. with blueprint.
> I am trying to send multiple messages using a custom processor to a
> tx-transacted jms endpoint with a ProducerTemplate according to  l
> <http://camel.apache.org/how-do-i-write-a-custom-processor-which-sends-multiple-messages.html>
> .
> XML:
> <template id="stackProducerTemplate"
> defaultEndpoint="amq-tx:queue:stackQueue?messageConverter=#byteStreamMessageConverter"
> camelContextId="camelContext"/>
> (the template is declared within the camelcontext camelContext, but with our
> without it does not matter)
> The error i get from blueprint on creation of the Template:
>
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
> validate xml
>
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'template'. One of
> '{"http://camel.apache.org/schema/blueprint":route}' is expected.
>
> Programmatically this works perfect, injecting the camel context in the
> processor and instantiating the template from it.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Producer template and spring xml defaultendpoint error

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

I guess you should adjust your XML namespace as you make use of Blueprint
and not Spring, so instead of:

  <camelContext xmlns="http://camel.apache.org/schema/spring">

Try it with:

  <camelContext xmlns="http://camel.apache.org/schema/blueprint">

Babak


Maurice wrote
> Using camel 2.11.0, Karaf 2.3.1. with blueprint.
> I am trying to send multiple messages using a custom processor to a
> tx-transacted jms endpoint with a ProducerTemplate according to 
> how-do-i-write-a-custom-processor-which-sends-multiple-messages
> <http://camel.apache.org/how-do-i-write-a-custom-processor-which-sends-multiple-messages.html>  
> .
> XML:
> <template id="stackProducerTemplate"
> defaultEndpoint="amq-tx:queue:stackQueue?messageConverter=#byteStreamMessageConverter"
> camelContextId="camelContext"/>
> (the template is declared within the camelcontext camelContext, but with
> our without it does not matter)
> The error i get from blueprint on creation of the Template:
> 
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable
> to validate xml
> 
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'template'. One of
> '{"http://camel.apache.org/schema/blueprint":route}' is expected.
> 
> Programmatically this works perfect, injecting the camel context in the
> processor and instantiating the template from it.





--
View this message in context: http://camel.465427.n5.nabble.com/Producer-template-and-spring-xml-defaultendpoint-error-tp5737471p5737473.html
Sent from the Camel - Users mailing list archive at Nabble.com.