Thank you, the problem is fixed with you processor.
regards, titexe Henric wrote: > > Hi, > > I had a similar problem and performed a workaround where I removed the BOM > characters in a Processor in my Camel Route. See code below. > > I'm not sure, but I think the problem is related to this bug in the JRE: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 > > Regards, > Henric > > public class RemoveBomProcessor implements Processor { > > public void process(Exchange exchange) throws Exception { > Object body = exchange.getIn(); > if (body instanceof GenericFileMessage) { > String content = ((GenericFileMessage) > body).getBody(String.class); > int startPosXml = new String(content).indexOf("<?xml"); > if (startPosXml >= 0) { > exchange.getIn().setBody(new > String(content).substring(startPosXml)); > } > } > } > } > > > > On Wed, Sep 30, 2009 at 4:28 PM, titexe > <abdellatifbouch...@eurofins.com>wrote: > >> >> Firstly, thank you for your response and responsiveness. >> >> my camel platform receives files from different applications that >> generate >> this type of xml file. >> >> I should be able to handle normal xml files and xml files with (BOM) >> >> there's a solution to solve this problem by a configuration in camel ? >> >> Thank you in advance >> >> >> Claus Ibsen-2 wrote: >> > >> > Hi >> > >> > Use a text editor that do NOT set that BOM character. >> > Or maybe your existing text editor can save in UTF-8 without the BOM. >> > >> > >> > >> > On Wed, Sep 30, 2009 at 3:42 PM, titexe >> <abdellatifbouch...@eurofins.com >> > >> > wrote: >> >> >> >> Hello, >> >> >> >> i have developped Camel route to transfrom file to message in queue >> >> >> >> This is my configuration: >> >> >> >> <camelContext id="camel" >> >> xmlns="http://activemq.apache.org/camel/schema/spring"> >> >> <route> >> >> <from >> >> >> uri="file:///c:/to_SAP/?consumer.recursive=true&consumer.alwaysConsume=true"/> >> >> <convertBodyTo type="java.lang.String"/> >> >> <to uri="activemq:queue:IN"/> >> >> </route> >> >> </camelContext> >> >> >> >> This error is received only in the case of some xml file,when i edit >> >> these >> >> files, I detected that there's (BOM) byte order mark. >> >> >> >> [Fatal Error] :1:1: Content is not allowed in prolog. >> >> DEBUG DefaultExceptionPolicyStrategy - Finding best suited exception >> >> policy >> >> for thrown exception org.xml.sax.SAXParseException >> >> DEBUG DefaultExceptionPolicyStrategy - No candidate found to be used >> as >> >> exception policy >> >> DEBUG DefaultExceptionPolicyStrategy - Finding best suited exception >> >> policy >> >> for thrown exception org.apache.camel.RuntimeCamelException >> >> DEBUG DefaultExceptionPolicyStrategy - No candidate found to be used >> as >> >> exception policy >> >> ERROR DeadLetterChannel - Failed delivery for exchangeId: >> >> ID-DCFR/4624-1254314223390/0-4155. On delivery attempt: 3 caught: >> >> org.apache.ca >> >> mel.RuntimeCamelException: org.xml.sax.SAXParseException: Content is >> not >> >> allowed in prolog. >> >> org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException: >> >> Content is not allowed in prolog. >> >> at >> >> org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:567) >> >> at >> >> >> org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:57) >> >> at >> >> >> org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo(DefaultTypeConverter.java:119) >> >> at >> >> >> org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:90) >> >> at >> >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:79) >> >> at >> >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:52) >> >> at >> >> >> org.apache.camel.builder.xml.XPathBuilder.getDocument(XPathBuilder.java:536) >> >> at >> >> >> org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:428) >> >> at >> >> >> org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:106) >> >> at >> >> >> org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:65) >> >> at >> >> >> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47) >> >> at >> >> >> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:80) >> >> at >> >> >> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:189) >> >> at >> >> >> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:133) >> >> at >> >> >> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68) >> >> at >> >> >> org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87) >> >> at >> >> >> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82) >> >> at >> >> >> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52) >> >> at >> >> >> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41) >> >> at >> >> >> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66) >> >> at >> >> >> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:72) >> >> at >> >> >> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531) >> >> at >> >> >> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466) >> >> at >> >> >> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435) >> >> at >> >> >> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:3 >> >> 22) >> >> >> >> version activemq : fuse message broker 5.3.0.3 >> >> version java : Java 1.6 >> >> >> >> Than you in advance to help to resolve this problem, >> >> >> >> Best regards, >> >> >> >> titexe >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Camel-%3A-file-to-Message---Error-SAX-%22XML%22-Byte-Order-Mark-%28BOM%29-tp25681297p25681297.html >> >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> > >> > -- >> > Claus Ibsen >> > Apache Camel Committer >> > >> > Open Source Integration: http://fusesource.com >> > Blog: http://davsclaus.blogspot.com/ >> > Twitter: http://twitter.com/davsclaus >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Camel-%3A-file-to-Message---Error-SAX-%22XML%22-Byte-Order-Mark-%28BOM%29-tp25681297p25682163.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://old.nabble.com/Camel-%3A-file-to-Message---Error-SAX-%22XML%22-Byte-Order-Mark-%28BOM%29-tp25681297p27595732.html Sent from the Camel - Users mailing list archive at Nabble.com.