Richa,

>From the stack trace, it looks like the 'Stream closed' problem occurs
while trying to send the attachments into a JMS queue.  This usually
happens when the attachments have been read/processed by something
before you get to that point.  One way to solve this issue would be to
find out what is processing the attachments.

Could you provide us with a bit more details about what you're trying
to do here (the flow of the message before it reaches the endpoint)?
Is it possible that the old servicemix instance had DEBUG logging
enabled and that this has not yet been set on the new instance?  Did
you create custom exchange listeners or auditors that might have read
the attachment?

Another thing you could do to avoid running into this issue, is avoid
sending the attachments in a non-rereadable format in the first place.
 You could do in your own marshaler by replacing the call to
super.readMessage with a copy of the method contents in the parent
BinaryFileMarshaler, replacing the StreamDataSource used there with
e.g. a BytesDataSource that allows reading from it multiple times.

Regards,

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



On 11 February 2010 06:38, Richa Khurana <[email protected]> wrote:
> Hello everyone,
> It will be really kind if you provide inputs for the issue, it's a
> blocker for me and I am not able to go ahead :(
> Thanks,
> Richa.
>
> -----Original Message-----
> From: Richa Khurana [mailto:[email protected]]
> Sent: Wednesday, February 10, 2010 3:56 PM
> To: [email protected]
> Subject: Unable to port file poller component to Fuse ESB 3.4
>
> Hi,
>
>
>
> I have a file poller which polls for PDF and TIFF Files. These files
> once polled are marshaled using CustomFileMarshaler extending from
> BinaryFileMarshaller which has the following overridden APIs-
>
>
>
>
>
>   �...@override public void readMessage(MessageExchange messageExchange,
> NormalizedMessage normalizedMessage,
>
>        InputStream inputStream, String path) throws IOException,
> JBIException {
>
>
>
>        try {
>
>            super.readMessage(messageExchange, normalizedMessage,
> inputStream, path);
>
>
>
>            String tempFilePathFull =
> storeUploadedFileInFS(normalizedMessage, path,
>
>                    path.substring(path.lastIndexOf(".")));
>
>            normalizedMessage.setContent(new StringSource(
>
>                    UtilConstants.FILE_POLLER_CUSTOM_TAG_START +
> tempFilePathFull +
>
>                    UtilConstants.FILE_POLLER_CUSTOM_TAG_END));
>
>        } catch (IOException exception) {
>
>            exception.printStackTrace();
>
>            throw exception;
>
>        }
>
>    }
>
>
>
> storeUploadedFileInFS(.. creates temp copy of the file being polled)
>
> This works completely fine with SMX3.2.x but fails once ported to
> FuseESB3.4 throwing the below stack trace. Kindly help.
>
>
>
> WARN  - FileComponent                  - Message in file
> C:\inbox\Cred_Appr_BCA1.pdf could not be handled successfully:
> java.io.IOException:
>
>  Stream closed
>
> org.apache.servicemix.soap.api.Fault: java.io.IOException: Stream closed
>
>        at
> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.h
> andleMessage(AttachmentsOutInterceptor.java:71)
>
>        at
> org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:85)
>
>        at
> org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler.createMessa
> ge(DefaultProviderMarshaler.java:79)
>
>        at
> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnlyInS
> ession(JmsProviderEndpoint.java:561)
>
>        at
> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint$1.doInJms(JmsPro
> viderEndpoint.java:531)
>
>        at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:428)
>
>        at
> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnly(Jm
> sProviderEndpoint.java:542)
>
>        at
> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.process(JmsProvi
> derEndpoint.java:499)
>
>        at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeC
> ycle.java:627)
>
>        at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBas
> eLifeCycle.java:581)
>
>        at
> org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncB
> aseLifeCycle.java:535)
>
>        at
> org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(Sync
> LifeCycleWrapper.java:60)
>
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(D
> eliveryChannelImpl.java:623)
>
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.j
> ava:172)
>
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java
> :168)
>
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:1
> 34)
>
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
> r.java:886)
>
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> va:908)
>
>        at java.lang.Thread.run(Thread.java:619)
>
> Caused by: java.io.IOException: Stream closed
>
>        at
> java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
>
>        at
> java.io.BufferedInputStream.read(BufferedInputStream.java:308)
>
>        at java.io.FilterInputStream.read(FilterInputStream.java:90)
>
>        at javax.activation.DataHandler.writeTo(DataHandler.java:293)
>
>        at
> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
>
>        at
> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)
>
>        at
> javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
>
>        at
> com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85)
>
>        at
> javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
>
>        at javax.activation.DataHandler.writeTo(DataHandler.java:302)
>
>        at
> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
>
>        at
> javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1683)
>
>        at
> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.w
> riteMultipartMessage(AttachmentsOutInterceptor.java:130)
>
>        at
> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.h
> andleMessage(AttachmentsOutInterceptor.java:67)
>
>
>
> Richa Khurana| Associate Consultant - Engineering| GlobalLogic Inc.
> USA | INDIA | UKRAINE | CHINA
> Office: +91.120.406.2681
>
> www.globallogic.com <http://www.globallogic.com/>
> InfoWorld Award Winner for Agile Innovation
> <http://www.globallogic.com/Media/pressReleaseDetail.asp?press/65>
>
> Disclaimer: http://www.globallogic.com/email_disclaimer.txt
> <http://www.globallogic.com/email_disclaimer.txt>
>
>
>
>

Reply via email to