7 Replies Latest reply on Jun 23, 2010 2:09 AM by Mitul Gandhi

    Servicemix-mail and Stream Closed

    Terrance Crow Newbie

      I've run into a situation trying to upgrade from FUSE ESB 3.4.0.2 to 3.4.0.4. The error I'm getting is:

       

      ERROR - MailComponent                  - Error sending mail...

      javax.mail.MessagingException: java.io.IOException: Stream closed;

        nested exception is:

           javax.xml.transform.TransformerException: java.io.IOException: Stream closed

           at org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertJBIToMail(DefaultMailMarshaler.java:96)

           at org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSenderEndpoint.java:123)

      ...

       

      I've built a three step workflow. A servicemix-file poller picks up a small XML file. It sends that file to a servicemix-bean component that adds a subject to the normalized message, then the servicemix-bean forwards the message to a servicemix-mail sender.

       

      It works fine under 3.4.0.2. However, it crashes with the above error in 3.4.0.3 and 3.4.0.4.

       

      I'm assuming the problem's my fault since I'm still learning the nuances of both Servicemix and its servicemix-bean component. However, even with the log4j logging set to DEBUG, I'm not seeing anything my component did that should cause this error.

       

      I've attached the source code for my MyBean.java in case it contains something stunningly obvious. It probably looks familiar, since I copied it from a recent forum post here. I just made some modifications to make it work for my workflow.

       

      I guess what bothers me is that it worked just fine under 3.4.0.2.

       

      I configured the other two components through the xbean.xml file. No custom properties or anything else except the defaults.

       

      What other information can I provide that might be helpful?

       

      Thank you!

       

      Thanks!

        • 1. Re: Servicemix-mail and Stream Closed
          Joe Luo Novice

          Is it possible for you to send in a test case please? So I can test here to find out what was causing the problem.

           

          Thanks,

          • 2. Re: Servicemix-mail and Stream Closed
            Terrance Crow Newbie

            Thank you very much for your response!

             

            I've attached two files: A sample input XML file that produces the error and the servicemix-bean's xbean.xml file. I've included the latter just in case I've misconfigured something.

             

            I tried to trace the source code, but I have to admit that I couldn't find DefaultMailMarshaler.java in the 3.4.0.4 source code I downloaded. I couldn't even find the method convertJBIToMail using Spotlight (I'm developing under OS X 10.5.8). I'm sure it was just because it was late when I tried.

             

            Please let me know if there's anything else I can provide. We're trying to build our first solution on FUSE ESB, and this is one of the issues that's in our way.

             

            Thank you!

             

            Edited by: terrancecrow on Aug 17, 2009 8:00 PM

            • 3. Re: Servicemix-mail and Stream Closed
              Joe Luo Novice

              The servicemix components are shared between Fuse ESB 4.1.x and 3.4.x, hence they have different naming scheme. The version of the servicemix components for Fuse ESB 3.4.0.4-fuse is 2009.01.0.4-fuse. Therefore, you can find that version of DefaultMailMarshaler.java file from svn repo here.

               

              I'll have a look at this issue.

              • 4. Re: Servicemix-mail and Stream Closed
                Joe Luo Novice

                I have got the test case working. I just modified your MyBean.java file and added two lines of code:

                 

                normout.setProperty("org.apache.servicemix.mail.subject", "This is a test subject");                    normout.setProperty("org.apache.servicemix.mail.text", body);

                 

                You will need to change the configuration of the mail-sender-test module to your own mail server and then compile and deploy.

                 

                Hope it helps,

                /Joe

                • 5. Re: Servicemix-mail and Stream Closed
                  Terrance Crow Newbie

                  Good evening!

                   

                  I tested your fix. Turns out my code already had this line:

                   

                  normout.setProperty("org.apache.servicemix.mail.subject", "This is a test subject");

                   

                  I just had the second line you identified just after it:

                   

                  normout.setProperty("org.apache.servicemix.mail.text", body);

                   

                  It's working just fine now!

                   

                  Wow -- that was all there was to it?

                   

                  I have to say I'm relieved it was my code. I'm glad that a 3.4.0.2 to 3.4.0.4 or 3.4.0.4 upgraded didn't break basic functionality.

                   

                  Thank you very much for taking the time to diagnose the problem. My team and I are one step closer to production!

                   

                  Thanks again!

                  • 6. Re: Servicemix-mail and Stream Closed
                    Mitul Gandhi Newbie

                    This test case does not seem to work in FUSE ESB 4.2 . Am I correct ?

                    • 7. Re: Servicemix-mail and Stream Closed
                      Mitul Gandhi Newbie

                      MessageExchangeListener and ClientFactory interfaces are deprecated and are not recognised by the  FUSE ESB 4.2.

                       

                      It shows the following error :

                      javax.jbi.management.DeploymentException: <component-task-result xmlns="http://java.sun.com/xml/ns/jbi/management-message">

                           <component-name>servicemix-bean</component-name>

                           <component-task-result-details>

                                <task-result-details>

                                     <task-id>deploy</task-id>

                                     <task-result>FAILED</task-result>

                                     <message-type>ERROR</message-type>

                                     <task-status-msg><msg-loc-info><loc-token/><loc-message>Could not deploy xbean service unit</loc-message></msg-loc-info></task-status-msg>

                                     <exception-info>

                                          <nesting-level>1</nesting-level>

                                          <msg-loc-info>

                                               <loc-token />

                                               <loc-message>Configuration problem: Class that bean class depends on not found

                      Offending resource: file

                      Bean 'myBean'; nested exception is java.lang.NoClassDefFoundError: org/apache/servicemix/MessageExchangeListener</loc-message>

                                               <stack-trace><![CDATA[org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Class that bean class depends on not found