You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Viali.Lee" <Vi...@Hotmail.COM> on 2007/08/01 15:50:41 UTC

Binary file to jms message...

I tried to modify the file-binding example, poll files to jms..
but failed..
     [java] ERROR - JmsComponent                   - Error processing
exchange InOnly[
     [java] id: ID:10.61.0.21-11421a853e7-5:0
     [java] status: Active
     [java] role: provider
     [java] service: fileReceiver
     [java] endpoint: endpoint
     [java] in: null
     [java] ]
     [java] javax.xml.stream.XMLStreamException: Trying to write
END_DOCUMENT when document has no root (ie. trying to output empty
document).
     [java] at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1396)
     [java] at
com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1425)
     [java] at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1586)
     [java] at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:508)
     [java] at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:129)
     [java] at
org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:140)
     [java] at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:89)
     [java] at
org.apache.servicemix.jms.AbstractJmsProcessor.fromNMS(AbstractJmsProcessor.java:149)
     [java] at
org.apache.servicemix.jms.AbstractJmsProcessor.fromNMS(AbstractJmsProcessor.java:143)
     [java] at
org.apache.servicemix.jms.jca.JcaProviderProcessor.process(JcaProviderProcessor.java:99)
     [java] at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
     [java] at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
     [java] at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
     [java] at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
     [java] at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
     [java] at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:171)
     [java] at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
     [java] at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
     [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
     [java] at java.lang.Thread.run(Unknown Source)


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
	xmlns:sm="http://servicemix.apache.org/config/1.0"
	xmlns:jms="http://servicemix.apache.org/jms/1.0"
	xmlns:amq="http://activemq.org/config/1.0"
	xmlns:amqra="http://activemq.org/ra/1.0"
	xmlns:amqpool="http://jencks.org/amqpool/2.0"
	xmlns:jencks="http://jencks.org/2.0"
	xmlns:my="http://servicemix.apache.org/demo/"
	xmlns:sigsit="http://sigsit.org/siris/node/1.0">
	<classpath>
		<location>.</location>
	</classpath>
	<sm:serviceunit id="jbi">

		<sm:activationSpecs>

			<!-- Look for files in the inbox directory -->
			<sm:activationSpec componentName="filePoller"
				 service="foo:filePoller" destinationService="foo:fileReceiver">
				<sm:component>
					<bean
						class="org.apache.servicemix.components.file.FilePoller">
						<property name="file" value="inbox" />
						<property name="period" value="1000" />
						<property name="marshaler">
							<bean
								class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
						</property>
					</bean>
				</sm:component>
			</sm:activationSpec>
			
			<sm:activationSpec componentName="fileReceiver">
				<sm:component>
					<jms:component>
						<jms:endpoints>
							<jms:endpoint service="foo:fileReceiver"
								endpoint="endpoint" role="provider" processorName="jca"
								connectionFactory="#jmsFactory"
								jmsProviderDestinationName="servicemix.result.file"
								destinationStyle="topic" />
						</jms:endpoints>
					</jms:component>
				</sm:component>
			</sm:activationSpec>		
			
			<!-- Write files to the outbox directory -->
			<sm:activationSpec componentName="fileSender"
				service="foo:fileSender">
				<sm:component>
					<bean
						class="org.apache.servicemix.components.file.FileWriter">
						<property name="directory" value="outbox" />
						<property name="marshaler">
							<bean
								class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
						</property>
					</bean>
				</sm:component>
			</sm:activationSpec>

		</sm:activationSpecs>

	</sm:serviceunit>

	<!-- Transaction Manager -->
	<jencks:transactionManager id="transactionManager" />

	<!-- Work manager -->
	<jencks:workManager id="workManager" threadPoolSize="25"
		transactionManager="#transactionManager" />

	<!-- Bootstrap context for JCA -->
	<jencks:bootstrapContext id="bootstrapContext"
		workManager="#workManager" transactionManager="#transactionManager" />

	<!-- the JCA Resource Adapter -->
	<amqra:resourceAdapter id="activeMQResourceAdapter"
		serverUrl="tcp://localhost:61616" />

	<!-- JMS Xa-enabled pooled factory -->
	<amqpool:jcaPooledConnectionFactory name="jmsFactory"
		transactionManager="#transactionManager" maxConnections="10"
		brokerURL="tcp://localhost:61616" />

</beans>


-- 
View this message in context: http://www.nabble.com/Binary-file-to-jms-message...-tf4200210s12049.html#a11945996
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Binary file to jms message...

Posted by Bruce Snyder <br...@gmail.com>.
On 8/1/07, Viali.Lee <Vi...@hotmail.com> wrote:
>
> I tried to modify the file-binding example, poll files to jms..
> but failed..
>      [java] ERROR - JmsComponent                   - Error processing
> exchange InOnly[
>      [java] id: ID:10.61.0.21-11421a853e7-5:0
>      [java] status: Active
>      [java] role: provider
>      [java] service: fileReceiver
>      [java] endpoint: endpoint
>      [java] in: null
>      [java] ]
>      [java] javax.xml.stream.XMLStreamException: Trying to write
> END_DOCUMENT when document has no root (ie. trying to output empty
> document).

Based on the error above, it appears that the content of the message
is not XML. What is the payload that is being sent?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/