You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pete Mueller <pe...@routecloud.com> on 2009/12/04 01:34:52 UTC

Errors parsing camel-context.xml

Hello, 

I am receiving the following error trying to start up my camel routing
bundle with a camel-context.xml in it. 

The error is:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
16 in XML document from URL
[bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
content was found starting with element 'json'. One of
'{"http://camel.apache.org/schema/spring":artixDS,
"http://camel.apache.org/schema/spring":bindy,
"http://camel.apache.org/schema/spring":csv,
"http://camel.apache.org/schema/spring":flatpack,
"http://camel.apache.org/schema/spring":gzip,
"http://camel.apache.org/schema/spring":hl7,
"http://camel.apache.org/schema/spring":jaxb,
"http://camel.apache.org/schema/spring":json,
"http://camel.apache.org/schema/spring":rss,
"http://camel.apache.org/schema/spring":secureXML,
"http://camel.apache.org/schema/spring":serialization,
"http://camel.apache.org/schema/spring":string,
"http://camel.apache.org/schema/spring":tidyMarkup,
"http://camel.apache.org/schema/spring":xmlBeans,
"http://camel.apache.org/schema/spring":xstream,
"http://camel.apache.org/schema/spring":zip}' is expected.

Clearly from the error, it shows that "json" is an allowed element. but SAX
says otherwise.  Any idea how to reconcile this?  I have a similar error
with using the placeholderPrefix attribute inside a property-placeholder
element.

Thanks,
-p

Here are relevant portions of my camel-context.xml if it helps.  I thought
perhaps I'm using the wrong schema. 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
	xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
	xmlns:camel="http://camel.apache.org/schema/spring"

	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
		http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
		http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

	<context:property-placeholder properties-ref="camelProps"
placeholderPrefix="#{" placeholderSuffix="}" />
	<camel:dataFormats> 
	  <json id="jsonMessage" library="Jackson"
unmarshalTypeName="com.routecloud.bean.Message" /> 
	</camel:dataFormats>
	
...
-- 
View this message in context: http://old.nabble.com/Errors-parsing-camel-context.xml-tp26635732p26635732.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Errors parsing camel-context.xml

Posted by Gert Vanthienen <ge...@gmail.com>.
Pete,

I think it's just a matter of adding the camel: prefix before the json
element as well - the way it is written now, the json element is not
using the camel namespace and I suspect that's why you're getting the
parse exception (which says it found element "json" and was expecting
"http://camel.apache.org/schema/spring":json )

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/12/4 Pete Mueller <pe...@routecloud.com>:
>
> Hello,
>
> I am receiving the following error trying to start up my camel routing
> bundle with a camel-context.xml in it.
>
> The error is:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 16 in XML document from URL
> [bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested
> exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'json'. One of
> '{"http://camel.apache.org/schema/spring":artixDS,
> "http://camel.apache.org/schema/spring":bindy,
> "http://camel.apache.org/schema/spring":csv,
> "http://camel.apache.org/schema/spring":flatpack,
> "http://camel.apache.org/schema/spring":gzip,
> "http://camel.apache.org/schema/spring":hl7,
> "http://camel.apache.org/schema/spring":jaxb,
> "http://camel.apache.org/schema/spring":json,
> "http://camel.apache.org/schema/spring":rss,
> "http://camel.apache.org/schema/spring":secureXML,
> "http://camel.apache.org/schema/spring":serialization,
> "http://camel.apache.org/schema/spring":string,
> "http://camel.apache.org/schema/spring":tidyMarkup,
> "http://camel.apache.org/schema/spring":xmlBeans,
> "http://camel.apache.org/schema/spring":xstream,
> "http://camel.apache.org/schema/spring":zip}' is expected.
>
> Clearly from the error, it shows that "json" is an allowed element. but SAX
> says otherwise.  Any idea how to reconcile this?  I have a similar error
> with using the placeholderPrefix attribute inside a property-placeholder
> element.
>
> Thanks,
> -p
>
> Here are relevant portions of my camel-context.xml if it helps.  I thought
> perhaps I'm using the wrong schema.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
>        xmlns:osgi="http://www.springframework.org/schema/osgi"
> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>                http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context.xsd
>                http://www.springframework.org/schema/osgi
> http://www.springframework.org/schema/osgi/spring-osgi.xsd
>                http://www.springframework.org/schema/osgi-compendium
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>                http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>        <context:property-placeholder properties-ref="camelProps"
> placeholderPrefix="#{" placeholderSuffix="}" />
>        <camel:dataFormats>
>          <json id="jsonMessage" library="Jackson"
> unmarshalTypeName="com.routecloud.bean.Message" />
>        </camel:dataFormats>
>
> ...
> --
> View this message in context: http://old.nabble.com/Errors-parsing-camel-context.xml-tp26635732p26635732.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: Errors parsing camel-context.xml

Posted by Pete Mueller <pe...@routecloud.com>.
@william, @Claus
Thank you for these tips.  I have solved part of this issue.  I did need to
change the element to <camel:json>

However, I am still getting the same type of error on the
<context:property-placeholder> element.  I took this example from the camel
tutorial (pt 2).

<context:property-placeholder properties-ref="camelProps"
placeholderPrefix="#{" placeholderSuffix="}" />

Looking at the online XSD
(http://www.springframework.org/schema/context/spring-context.xsd) There is
no listing for "placeholderPrefix"or "placeholderSuffix".  Which leads me to
the belief the tutorial is using a different schema.  Any idea which one?

I am using Karaf 1.0.0, Camel 2.0, Spring 2.5.6.SEC01

-pete

p.s. I am guessing that the tutorial assumed a ServiceMix 4.0 installation.
I have successfully gotten Camel/ActiveMQ/Hibernate/etc working in
out-of-box Karaf 1.0 and my feature file looks fairly different than the
tutorial.   I'd be happy to share it with those interested, or attach it to
the tutorial, if someone would enlighten me on the best way to do that.



Claus Ibsen-2 wrote:
> 
> On Fri, Dec 4, 2009 at 2:25 AM, Willem Jiang <wi...@gmail.com>
> wrote:
>> Which version of ServiceMix are you using?
>> Can you past your camel-context file?
>>
>> Maybe you are not using a right version of camel-spring schema ?
>>
> 
> Yeah I think some of the data formats got cleaned up in 2.1. And json
> could very well be one of them.
> So make sure to use the XSD version that matches the version of Camel.
> 
> And beware some IDE tools will use the online XSD which is SNAPSHOT based.
> You should really use the XSD which is located in camel-spring.jar you
> are using.
> 
> 
> What you can always do is to declare the data format in the top
> 
> <dataFormats>
>    <json id="myJson" .../>
> </dataFormat>
> 
> And then refer to it in the route
> 
> <marshal id="myJson"/>
> 
> 
>> Willem
>>
>> Pete Mueller wrote:
>>>
>>> Hello,
>>> I am receiving the following error trying to start up my camel routing
>>> bundle with a camel-context.xml in it.
>>> The error is:
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
>>> Line
>>> 16 in XML document from URL
>>> [bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested
>>> exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
>>> Invalid
>>> content was found starting with element 'json'. One of
>>> '{"http://camel.apache.org/schema/spring":artixDS,
>>> "http://camel.apache.org/schema/spring":bindy,
>>> "http://camel.apache.org/schema/spring":csv,
>>> "http://camel.apache.org/schema/spring":flatpack,
>>> "http://camel.apache.org/schema/spring":gzip,
>>> "http://camel.apache.org/schema/spring":hl7,
>>> "http://camel.apache.org/schema/spring":jaxb,
>>> "http://camel.apache.org/schema/spring":json,
>>> "http://camel.apache.org/schema/spring":rss,
>>> "http://camel.apache.org/schema/spring":secureXML,
>>> "http://camel.apache.org/schema/spring":serialization,
>>> "http://camel.apache.org/schema/spring":string,
>>> "http://camel.apache.org/schema/spring":tidyMarkup,
>>> "http://camel.apache.org/schema/spring":xmlBeans,
>>> "http://camel.apache.org/schema/spring":xstream,
>>> "http://camel.apache.org/schema/spring":zip}' is expected.
>>>
>>> Clearly from the error, it shows that "json" is an allowed element. but
>>> SAX
>>> says otherwise.  Any idea how to reconcile this?  I have a similar error
>>> with using the placeholderPrefix attribute inside a property-placeholder
>>> element.
>>>
>>> Thanks,
>>> -p
>>>
>>> Here are relevant portions of my camel-context.xml if it helps.  I
>>> thought
>>> perhaps I'm using the wrong schema.
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:context="http://www.springframework.org/schema/context"
>>>        xmlns:osgi="http://www.springframework.org/schema/osgi"
>>> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>>>        xmlns:camel="http://camel.apache.org/schema/spring"
>>>
>>>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>                http://www.springframework.org/schema/context
>>> http://www.springframework.org/schema/context/spring-context.xsd
>>>                http://www.springframework.org/schema/osgi
>>> http://www.springframework.org/schema/osgi/spring-osgi.xsd
>>>                http://www.springframework.org/schema/osgi-compendium
>>>
>>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>>                http://camel.apache.org/schema/spring
>>> http://camel.apache.org/schema/spring/camel-spring.xsd">
>>>
>>>        <context:property-placeholder properties-ref="camelProps"
>>> placeholderPrefix="#{" placeholderSuffix="}" />
>>>        <camel:dataFormats>          <json id="jsonMessage"
>>> library="Jackson"
>>> unmarshalTypeName="com.routecloud.bean.Message" />
>>>  </camel:dataFormats>
>>>
>>> ...
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Errors-parsing-camel-context.xml-tp26635732p26646469.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Errors parsing camel-context.xml

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 4, 2009 at 2:25 AM, Willem Jiang <wi...@gmail.com> wrote:
> Which version of ServiceMix are you using?
> Can you past your camel-context file?
>
> Maybe you are not using a right version of camel-spring schema ?
>

Yeah I think some of the data formats got cleaned up in 2.1. And json
could very well be one of them.
So make sure to use the XSD version that matches the version of Camel.

And beware some IDE tools will use the online XSD which is SNAPSHOT based.
You should really use the XSD which is located in camel-spring.jar you
are using.


What you can always do is to declare the data format in the top

<dataFormats>
   <json id="myJson" .../>
</dataFormat>

And then refer to it in the route

<marshal id="myJson"/>


> Willem
>
> Pete Mueller wrote:
>>
>> Hello,
>> I am receiving the following error trying to start up my camel routing
>> bundle with a camel-context.xml in it.
>> The error is:
>> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
>> Line
>> 16 in XML document from URL
>> [bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested
>> exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
>> Invalid
>> content was found starting with element 'json'. One of
>> '{"http://camel.apache.org/schema/spring":artixDS,
>> "http://camel.apache.org/schema/spring":bindy,
>> "http://camel.apache.org/schema/spring":csv,
>> "http://camel.apache.org/schema/spring":flatpack,
>> "http://camel.apache.org/schema/spring":gzip,
>> "http://camel.apache.org/schema/spring":hl7,
>> "http://camel.apache.org/schema/spring":jaxb,
>> "http://camel.apache.org/schema/spring":json,
>> "http://camel.apache.org/schema/spring":rss,
>> "http://camel.apache.org/schema/spring":secureXML,
>> "http://camel.apache.org/schema/spring":serialization,
>> "http://camel.apache.org/schema/spring":string,
>> "http://camel.apache.org/schema/spring":tidyMarkup,
>> "http://camel.apache.org/schema/spring":xmlBeans,
>> "http://camel.apache.org/schema/spring":xstream,
>> "http://camel.apache.org/schema/spring":zip}' is expected.
>>
>> Clearly from the error, it shows that "json" is an allowed element. but
>> SAX
>> says otherwise.  Any idea how to reconcile this?  I have a similar error
>> with using the placeholderPrefix attribute inside a property-placeholder
>> element.
>>
>> Thanks,
>> -p
>>
>> Here are relevant portions of my camel-context.xml if it helps.  I thought
>> perhaps I'm using the wrong schema.
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:context="http://www.springframework.org/schema/context"
>>        xmlns:osgi="http://www.springframework.org/schema/osgi"
>> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
>>        xmlns:camel="http://camel.apache.org/schema/spring"
>>
>>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>                http://www.springframework.org/schema/context
>> http://www.springframework.org/schema/context/spring-context.xsd
>>                http://www.springframework.org/schema/osgi
>> http://www.springframework.org/schema/osgi/spring-osgi.xsd
>>                http://www.springframework.org/schema/osgi-compendium
>>
>> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
>>                http://camel.apache.org/schema/spring
>> http://camel.apache.org/schema/spring/camel-spring.xsd">
>>
>>        <context:property-placeholder properties-ref="camelProps"
>> placeholderPrefix="#{" placeholderSuffix="}" />
>>        <camel:dataFormats>          <json id="jsonMessage"
>> library="Jackson"
>> unmarshalTypeName="com.routecloud.bean.Message" />
>>  </camel:dataFormats>
>>
>> ...
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Errors parsing camel-context.xml

Posted by Willem Jiang <wi...@gmail.com>.
Which version of ServiceMix are you using?
Can you past your camel-context file?

Maybe you are not using a right version of camel-spring schema ?

Willem

Pete Mueller wrote:
> Hello, 
> 
> I am receiving the following error trying to start up my camel routing
> bundle with a camel-context.xml in it. 
> 
> The error is:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 16 in XML document from URL
> [bundle://135.0:0/META-INF/spring/camel-context.xml] is invalid; nested
> exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'json'. One of
> '{"http://camel.apache.org/schema/spring":artixDS,
> "http://camel.apache.org/schema/spring":bindy,
> "http://camel.apache.org/schema/spring":csv,
> "http://camel.apache.org/schema/spring":flatpack,
> "http://camel.apache.org/schema/spring":gzip,
> "http://camel.apache.org/schema/spring":hl7,
> "http://camel.apache.org/schema/spring":jaxb,
> "http://camel.apache.org/schema/spring":json,
> "http://camel.apache.org/schema/spring":rss,
> "http://camel.apache.org/schema/spring":secureXML,
> "http://camel.apache.org/schema/spring":serialization,
> "http://camel.apache.org/schema/spring":string,
> "http://camel.apache.org/schema/spring":tidyMarkup,
> "http://camel.apache.org/schema/spring":xmlBeans,
> "http://camel.apache.org/schema/spring":xstream,
> "http://camel.apache.org/schema/spring":zip}' is expected.
> 
> Clearly from the error, it shows that "json" is an allowed element. but SAX
> says otherwise.  Any idea how to reconcile this?  I have a similar error
> with using the placeholderPrefix attribute inside a property-placeholder
> element.
> 
> Thanks,
> -p
> 
> Here are relevant portions of my camel-context.xml if it helps.  I thought
> perhaps I'm using the wrong schema. 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
> 	xmlns:osgi="http://www.springframework.org/schema/osgi"
> xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> 		http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context.xsd
> 		http://www.springframework.org/schema/osgi
> http://www.springframework.org/schema/osgi/spring-osgi.xsd
> 		http://www.springframework.org/schema/osgi-compendium
> http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
> 		http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> 
> 	<context:property-placeholder properties-ref="camelProps"
> placeholderPrefix="#{" placeholderSuffix="}" />
> 	<camel:dataFormats> 
> 	  <json id="jsonMessage" library="Jackson"
> unmarshalTypeName="com.routecloud.bean.Message" /> 
> 	</camel:dataFormats>
> 	
> ...