Let me describe a step-by-step guide so you can recreate it.

Ok, I have constructed a small example using a freshly downloaded copy of
Camel 2.4.0.

I'am using the provided example protobuffer definition from the example:
addressbook.proto and run the protobuffer-compiler protoc to generate the
Java-files

After that created a spring-xml file in the META-INF/spring directory with
the following content:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    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-3.0.xsd
        http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
  <route>
    <from uri="direct:start"/>
    <unmarshal>
      <protobuf
instanceClass="org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person"
/>
    </unmarshal>
    <to uri="mock:result"/>
  </route>
</camelContext>

</beans>

Then created a small starter class which started the Camel-main class
(org.apache.camel.spring.Main)  and I get the following log with exceptions:

14-sep-2010 10:56:10 org.apache.camel.impl.MainSupport doStart
INFO: Apache Camel 2.4.0 starting
14-sep-2010 10:56:10
org.springframework.context.support.AbstractApplicationContext
prepareRefresh
INFO: Refreshing
org.springframework.context.support.classpathxmlapplicationcont...@1457cb:
startup date [Tue Sep 14 10:56:10 CEST 2010]; root of context hierarchy
14-sep-2010 10:56:10
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from file
[D:\projects\CamelProtobufTest\bin\META-INF\spring\camel-protobuf-test.xml]
14-sep-2010 10:56:10 org.apache.camel.impl.MainSupport doStop
INFO: Apache Camel 2.4.0 stopping
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
12 in XML document from file
[D:\projects\CamelProtobufTest\bin\META-INF\spring\camel-protobuf-test.xml]
is invalid; nested exception is org.xml.sax.SAXParseException:
cvc-complex-type.2.4.a: Invalid content was found starting with element
'protobuf'. One of '{"http://camel.apache.org/schema/spring":description, "
http://camel.apache.org/schema/spring":aop, "
http://camel.apache.org/schema/spring":aggregate, "
http://camel.apache.org/schema/spring":bean, "
http://camel.apache.org/schema/spring":doCatch, "
http://camel.apache.org/schema/spring":when, "
http://camel.apache.org/schema/spring":choice, "
http://camel.apache.org/schema/spring":otherwise, "
http://camel.apache.org/schema/spring":convertBodyTo, "
http://camel.apache.org/schema/spring":delay, "
http://camel.apache.org/schema/spring":enrich, "
http://camel.apache.org/schema/spring":filter, "
http://camel.apache.org/schema/spring":doFinally, "
http://camel.apache.org/schema/spring":idempotentConsumer, "
http://camel.apache.org/schema/spring":inOnly, "
http://camel.apache.org/schema/spring":inOut, "
http://camel.apache.org/schema/spring":intercept, "
http://camel.apache.org/schema/spring":interceptFrom, "
http://camel.apache.org/schema/spring":interceptToEndpoint, "
http://camel.apache.org/schema/spring":loadBalance, "
http://camel.apache.org/schema/spring":log, "
http://camel.apache.org/schema/spring":loop, "
http://camel.apache.org/schema/spring":marshal, "
http://camel.apache.org/schema/spring":multicast, "
http://camel.apache.org/schema/spring":onCompletion, "
http://camel.apache.org/schema/spring":onException, "
http://camel.apache.org/schema/spring":pipeline, "
http://camel.apache.org/schema/spring":policy, "
http://camel.apache.org/schema/spring":pollEnrich, "
http://camel.apache.org/schema/spring":process, "
http://camel.apache.org/schema/spring":recipientList, "
http://camel.apache.org/schema/spring":removeHeader, "
http://camel.apache.org/schema/spring":removeHeaders, "
http://camel.apache.org/schema/spring":removeProperty, "
http://camel.apache.org/schema/spring":resequence, "
http://camel.apache.org/schema/spring":rollback, "
http://camel.apache.org/schema/spring":route, "
http://camel.apache.org/schema/spring":routingSlip, "
http://camel.apache.org/schema/spring":sample, "
http://camel.apache.org/schema/spring":setBody, "
http://camel.apache.org/schema/spring":setExchangePattern, "
http://camel.apache.org/schema/spring":setHeader, "
http://camel.apache.org/schema/spring":setOutHeader, "
http://camel.apache.org/schema/spring":setProperty, "
http://camel.apache.org/schema/spring":sort, "
http://camel.apache.org/schema/spring":split, "
http://camel.apache.org/schema/spring":stop, "
http://camel.apache.org/schema/spring":threads, "
http://camel.apache.org/schema/spring":throttle, "
http://camel.apache.org/schema/spring":throwException, "
http://camel.apache.org/schema/spring":to, "
http://camel.apache.org/schema/spring":transacted, "
http://camel.apache.org/schema/spring":transform, "
http://camel.apache.org/schema/spring":doTry, "
http://camel.apache.org/schema/spring":unmarshal, "
http://camel.apache.org/schema/spring":validate, "
http://camel.apache.org/schema/spring":wireTap, "
http://camel.apache.org/schema/spring":bindy, "
http://camel.apache.org/schema/spring":castor, "
http://camel.apache.org/schema/spring":csv, "
http://camel.apache.org/schema/spring":crypto, "
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.
 at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
 at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
 at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
 at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
 at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
 at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
 at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
 at
org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:219)
at org.apache.camel.spring.Main.doStart(Main.java:173)
 at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:114)
 at org.apache.camel.impl.MainSupport.run(MainSupport.java:291)
at TestProtobuf.main(TestProtobuf.java:11)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
content was found starting with element 'protobuf'. One of '{"
http://camel.apache.org/schema/spring":description, "
http://camel.apache.org/schema/spring":aop, "
http://camel.apache.org/schema/spring":aggregate, "
http://camel.apache.org/schema/spring":bean, "
http://camel.apache.org/schema/spring":doCatch, "
http://camel.apache.org/schema/spring":when, "
http://camel.apache.org/schema/spring":choice, "
http://camel.apache.org/schema/spring":otherwise, "
http://camel.apache.org/schema/spring":convertBodyTo, "
http://camel.apache.org/schema/spring":delay, "
http://camel.apache.org/schema/spring":enrich, "
http://camel.apache.org/schema/spring":filter, "
http://camel.apache.org/schema/spring":doFinally, "
http://camel.apache.org/schema/spring":idempotentConsumer, "
http://camel.apache.org/schema/spring":inOnly, "
http://camel.apache.org/schema/spring":inOut, "
http://camel.apache.org/schema/spring":intercept, "
http://camel.apache.org/schema/spring":interceptFrom, "
http://camel.apache.org/schema/spring":interceptToEndpoint, "
http://camel.apache.org/schema/spring":loadBalance, "
http://camel.apache.org/schema/spring":log, "
http://camel.apache.org/schema/spring":loop, "
http://camel.apache.org/schema/spring":marshal, "
http://camel.apache.org/schema/spring":multicast, "
http://camel.apache.org/schema/spring":onCompletion, "
http://camel.apache.org/schema/spring":onException, "
http://camel.apache.org/schema/spring":pipeline, "
http://camel.apache.org/schema/spring":policy, "
http://camel.apache.org/schema/spring":pollEnrich, "
http://camel.apache.org/schema/spring":process, "
http://camel.apache.org/schema/spring":recipientList, "
http://camel.apache.org/schema/spring":removeHeader, "
http://camel.apache.org/schema/spring":removeHeaders, "
http://camel.apache.org/schema/spring":removeProperty, "
http://camel.apache.org/schema/spring":resequence, "
http://camel.apache.org/schema/spring":rollback, "
http://camel.apache.org/schema/spring":route, "
http://camel.apache.org/schema/spring":routingSlip, "
http://camel.apache.org/schema/spring":sample, "
http://camel.apache.org/schema/spring":setBody, "
http://camel.apache.org/schema/spring":setExchangePattern, "
http://camel.apache.org/schema/spring":setHeader, "
http://camel.apache.org/schema/spring":setOutHeader, "
http://camel.apache.org/schema/spring":setProperty, "
http://camel.apache.org/schema/spring":sort, "
http://camel.apache.org/schema/spring":split, "
http://camel.apache.org/schema/spring":stop, "
http://camel.apache.org/schema/spring":threads, "
http://camel.apache.org/schema/spring":throttle, "
http://camel.apache.org/schema/spring":throwException, "
http://camel.apache.org/schema/spring":to, "
http://camel.apache.org/schema/spring":transacted, "
http://camel.apache.org/schema/spring":transform, "
http://camel.apache.org/schema/spring":doTry, "
http://camel.apache.org/schema/spring":unmarshal, "
http://camel.apache.org/schema/spring":validate, "
http://camel.apache.org/schema/spring":wireTap, "
http://camel.apache.org/schema/spring":bindy, "
http://camel.apache.org/schema/spring":castor, "
http://camel.apache.org/schema/spring":csv, "
http://camel.apache.org/schema/spring":crypto, "
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.
 at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
 at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1777)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:705)
 at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
 at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
 at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
 at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
 at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
 at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
 ... 19 more


To finish my classpath contains the following jar-files:
camel-core-2.4.0.jar
camel-protobuf-2.4.0.jar
camel-spring-2.4.0.jar
commons-logging-1.1.1.jar
protobuf-java-2.2.0.jar
spring-asm-3.0.3.RELEASE.jar
spring-beans-3.0.3.RELEASE.jar
spring-context-3.0.3.RELEASE.jar
spring-core-3.0.3.RELEASE.jar

Hope this clarifies my problem with the provided example.

Cheers,
Marcel Jager

On Mon, Sep 13, 2010 at 3:54 PM, Ashwin Karpe <aka...@fusesource.com> wrote:

>
> Hi,
>
> Can you provide more details about Camel version etc. The example is fine
> and the camel schema does support the <protobuf> dataformat.
>
> The only thing I can think of is that you might be using a much older
> version of camel that did not have protobuf dataformat support at the time.
> Please provide the relevant details.
>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-protobuf-example-Spring-DSL-to-unmarshal-to-protobuf-tp2835112p2837717.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to