Hi All!
Start playing with Servicemix and got some questions. As a first
exercise I tried to bind HTTPConnector together with TraceComponent in
order to just display everything posted by httpclient.
So my config looked like this:
<sm:activationSpecs>
<sm:activationSpec componentName="httpReceiver"
service="foo:httpBinding"
endpoint="httpReceiver"
destinationService="foo:trace">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.http.HttpConnector">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
<property name="defaultInOut" value="false"/>
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="trace"
service="foo:trace"
>
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.util.TraceComponent">
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
Then I ran HTTPClient.java from the HTTPBinding example and got the
following errors despite that XML file sent by the client was quite valid:
[INFO] DeliveryChannel - default destination serviceName for httpReceiver =
{http://servicemix.org/demo/}trace
[INFO] TraceComponent - Exchange: [EMAIL PROTECTED] received IN message: [EMAIL
PROTECTED]: {}}
[Fatal Error] :-1:-1: Premature end of file.
[ERROR] TraceComponent - Failed to turn message body into text:
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Premature end of file. <javax.xml.transform.TransformerException:
org.xml.sax.SAXParseException: Premature end of
file.>javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Premature end of file.
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501)
at
org.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:82)
at
org.servicemix.jbi.jaxp.SourceTransformer.toString(SourceTransformer.java:102)
at
org.servicemix.components.util.TraceComponent.onMessageExchange(TraceComponent.java:67)
at
org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:588)
at
org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
at org.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:225)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
... 9 more
-
Surprisingly, when I replace http connector with file binding then
everything works as expected.
Here is my new config:
<sm:container>
<sm:activationSpecs>
<sm:activationSpec componentName="filePoller"
destinationService="foo:trace" service="foo:filePoller">
<sm:component>
<bean
xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.file.FilePoller">
<property name="workManager"
ref="workManager" />
<property name="file" value="inbox" />
<property name="period" value="1000" />
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="trace"
service="foo:trace"
>
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.util.TraceComponent">
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
<!-- the work manager (thread pool) for this container -->
<bean id="workManager"
class="org.jencks.factory.WorkManagerFactoryBean">
<property name="threadPoolSize" value="30" />
</bean>
When the same XML file is being placed into the inbox folder, TraceComponent
dumps it's
contents to the log without any errors.
Can anyone tell why do things work with FilePoller and do not work with
HTTPConnector?