Missing start boundary

Hi ,
i have Missing start boundary exception while reading message..
Following is message information.Can any one let me know how i can fix this problem.
Received: from backup1.texterity.com ([68.112.246.59]) by exchange2003.scientificmonitoring.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 8 Mar 2007 11:37:05 -0700
Received: from backup1.texterity.com (localhost.localdomain [127.0.0.1]) by backup1.texterity.com (8.13.1/8.13.1) with ESMTP id l28IaTnQ023719 for <[email protected]>; Thu, 8 Mar 2007 13:36:29 -0500
Received: (from textcafe@localhost) by backup1.texterity.com (8.13.1/8.13.1/Submit) id l28IaR1K023718; Thu, 8 Mar 2007 13:36:27 -0500
Content-Transfer-Encoding: binary
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_20F60_01C76D97.08C9D40D"
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.01 (F2.73; A1.67; B3.05; Q3.03)
Date: Thu, 8 Mar 2007 18:36:26 UT
From: <[email protected]>
Subject: Intech March 2007 Digital Edition
To: <[email protected]>
Message-ID: [email protected]
Return-Path: <[email protected]>
X-OriginalArrivalTime: 08 Mar 2007 18:37:05.0234 (UTC) FILETIME=[C51A9320:01C761B0]
This is a multi-part message in MIME format.
------=_NextPart_000_20F63_01C76D97.08C9D40D
Content-Disposition: inline
Content-Length: 1066
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
     charset="iso-8859-1"
You can now find your March issue of InTech at=20
http://pubsrv.texterity.com/cgi-bin/pwf_gateway.cgi?d=3Dwww.isa-intech-di=
gital.org&u=3D/intech/200703&s=3DCEGUsgx3DOlJm&e=3D3567746.=20
Each month, we will e-mail you a link to the current issue of InTech.
Your digital issue has the exact same content as a printed copy but with
unique features, such as the ability to:
*     Search and page through articles online=20
*     Zoom, print, or e-mail pages to a colleague=20
*     Archive your issues for convenient retrieval=20
We hope you enjoy your digital issues of InTech magazine. Thank you for
your readership.
Sincerely,=20
Gregory Hale
InTech Editor=20
Click here to convert to the print edition: =
http://pubsrv.texterity.com/cgi-bin/pwf_optout.cgi?c=3Dintech&e=3Djim@sci=
entificmonitoring.com&email_msgid=3D3567746
This email was sent to: [email protected]
Please do not reply to this mail.
For technical questions regarding the digital edition, email =
[email protected].
From ISA, PO Box 12277, 67 Alexander Drive, Research Triangle Park, NC =
27709
------=_NextPart_000_20F63_01C76D97.08C9D40D
Content-Disposition: inline
Content-Length: 4386
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
     charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Intech Digital Edition</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1">
</head>
<body>
<IMG =
SRC=3D"http://pubsrv.texterity.com/cgi-bin/pwf_eds.cgi?transaction_type=3D=
datalog&[email protected]&publication=3Dintech=
&id_stamp=3Dintech.20070308133626&user_action=3Dviewmail&email_msgid=3D35=
67746" height=3D"0" width=3D"0" border=3D"0">
<TABLE WIDTH=3D613 BORDER=3D0 CELLPADDING=3D0 CELLSPACING=3D0>
     <TR>
          <TD COLSPAN=3D2><A =
HREF=3D"http://pubsrv.texterity.com/cgi-bin/pwf_gateway.cgi?d=3Dwww.isa-i=
ntech-digital.org&u=3D/intech/200703&s=3DCEGUsgx3DOlJm&e=3D3567746" =
TARGET=3D"_blank" TITLE=3D"Intech">
               <IMG BORDER=3D0 =
SRC=3D"http://www.texterity.com/images/intech/intech_header.gif" =
WIDTH=3D613 HEIGHT=3D116></A></TD></TR>
     <TR>
          <TD VALIGN=3DTOP WIDTH=3D144>
          <TABLE BORDER=3D0 CELLPADDING=3D6 CELLSPACING=3D6><TR =
ALIGN=3DCENTER><TD ALIGN=3DCENTER>
          <A =
HREF=3D"http://pubsrv.texterity.com/cgi-bin/pwf_gateway.cgi?d=3Dwww.isa-i=
ntech-digital.org&u=3D/intech/200703&s=3DCEGUsgx3DOlJm&e=3D3567746" =
TARGET=3D"_blank" TITLE=3D"Click here to read Intech">
          <IMG style=3D"border: solid 1px; border-color: black" =
SRC=3D"http://www.isa-intech-digital.org/tcprojects/isa/intech/inbox/3820=
4/imgpages/tn/intech200703_0001.gif"
               ALT=3D"Click here to read Intech"></A></TD></TR>
          <TR HEIGHT=3D109><TD> </TD></TR>
          <TR ALIGN=3DCENTER><TD ALIGN=3DCENTER><A =
HREF=3D"http://www.texterity.com" TARGET=3D"_blank">
          <IMG BORDER=3D0 =
SRC=3D"http://www.texterity.com/images/ViaTexterity.gif" width=3D132 =
height=3D45 ALT=3D"Digital Delivery Via =
Texterity"></A></TD></TR></TABLE></TD>
          <TD VALIGN=3DTOP><TABLE BORDER=3D0 CELLPADDING=3D6 =
CELLSPACING=3D6><TR><TD>
          <P style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">
          You can now find your March issue of InTech at <br><a =
href=3D"http://pubsrv.texterity.com/cgi-bin/pwf_gateway.cgi?d=3Dwww.isa-i=
ntech-digital.org&u=3D/intech/200703&s=3DCEGUsgx3DOlJm&e=3D3567746" =
target=3D"_blank">http://www.isa-intech-digital.org/intech/200703/</a>.
          </p>
          <P style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">Each month, we will e-mail you a link to the current =
issue of InTech. Your digital issue has the exact same content as a =
printed copy but with unique features, such as the ability to:</p>
          <ul><li style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">
          Search and page through articles online </li>
          <li style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">Zoom, print, or e-mail pages to a colleague</li>
          <li style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">Archive your issues for convenient retrieval</li></ul>
          <P style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">We hope you enjoy your digital issues of InTech =
magazine. Thank you for your readership.</p>
          <P style=3D"font-family:verdana,arial,helvetica,sans-serif; =
font-size:12px;">
          Sincerely,<br><br>
          Gregory Hale<br>
          InTech Editor
          </P>
     </TD></TR></TABLE>
</TD></TR></TABLE>
<TABLE WIDTH=3D613 BORDER=3D0 CELLPADDING=3D0 CELLSPACING=3D0><TR><TD>
     <table width=3D"100%" border=3D"0" cellspacing=3D"0" cellpadding=3D"0" =
bgcolor=3D"#FFFFEE">
          <tr><td>
          <IMG BORDER=3D0 =
SRC=3D"http://www.texterity.com/images/recycling-footer.gif" WIDTH=3D613 =
HEIGHT=3D11>
<font face=3D"arial" size=3D"1" color=3Dblack>
  <a =
href=3D"http://pubsrv.texterity.com/cgi-bin/pwf_optout.cgi?c=3Dintech&e=3D=
[email protected]&email_msgid=3D3567746">Click here</a> to =
Convert to the print edition.<BR>
  This email was sent to: [email protected]<BR>
  If you cannot click on the links above, please copy and paste =
this url into your browser:<BR>
  <a =
href=3D"http://pubsrv.texterity.com/cgi-bin/pwf_gateway.cgi?d=3Dwww.isa-i=
ntech-digital.org&u=3D/intech/200703&s=3DCEGUsgx3DOlJm&e=3D3567746">http:=
//www.isa-intech-digital.org/intech/200703/</A><BR>
  Please do not reply to this mail.<BR>
  For technical questions regarding the digital edition, email <a =
href=3D"mailto:[email protected]?subject=3DIntech%20Support%2=
0Request">[email protected]</a>.<BR>
  From From ISA, PO Box 12277, 67 Alexander Drive, Research =
Triangle Park, NC 27709</font><br>
          </td></tr>
          <tr><td bgcolor=3D"#FFFFEE">
     </td></tr></table>
</TD></TR></TABLE>
</body>
</html>
------=_NextPart_000_20F63_01C76D97.08C9D40D--
can any one please help how i can fix this.

Right on all counts. I have been able to resolve #1 and #2 using the prescribed workarounds.
I'm still persuing #3 This seems to be the most common issue, as our application receives dozens of these each day. Our mail administrator gave the "it's working with everything else" response - of course everything else is probably not using the IMAP interface... If anyone has had a similar problem with Trend or Sophos specifically, let me know. I will need to output the raw IMAP stream, find the specific RFC 2822 violation and take it to the vendor. Any setting on the JavaMail side to compensate for the problem, would of course be helpful. I have to be careful not to break working messages that have file attachments, though. It's possible that my attempt of the workaround you described was incorrect - I'll go back and try it again with a simpler code example.
#4 I've not had success with JTNEF yet, but I'm not sure if it's even still a problem after the workaround for #2. Anyway, that one seems to be infrequent so it's low priority for me.
#5 As you mention in the other thread: this is a problem with a couple of email clients (Thunderbird and Apple Mail, possibly others) - maybe they are using a common library? Anyway, I'm going to try out the workaround posted in that thread if I can get more specifics.
It would be nice if the various workarounds could be handled within JavaMail, a global LIBERAL=true setting : ) , although I understand that could be a never-ending project for JavaMail considering the number of vendor problems. Also such workarounds could certainly cause "code entropy" within JavaMail code. Getting the vendor to fix their product also kind of depends on whether or not I have 'business leverage' on the buggy software. In my case, for example, I can apply leverage on virus gateway vendors to fix their product, but not on customers who are sending me incorrectly formatted emails and have the option of going elsewhere for business.
In any case, thanks for all the help - it has been greatly appreciated.

Similar Messages

  • Missing start boundary exception, caused by an empty Part, how to handle?

    Hello,
    i wrote an application that automatically handles mails from laboratories. The only essential part of the mail is the attachment, where chemical analyses are submitted (from permitted addresses, recognized by whitelist and fileheader of the attachment). Other ways to submit data weren't allowed.
    Currently a mail was received that can't be parsed. It's from a laboratory, that
    use its provider's (a german internet suplier named Arcor) webmail, a browser-based mailing portal. It always worked fine, because they wrote some greetings. But this time they sent a blank message. The result is following structure of the mail:
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
    boundary="----=_Part_50112_10709369.1203586767396"
    //Some X-Flags
    ------=_Part_50112_10709369.1203586767396
    Content-Type: multipart/alternative;
         boundary="*----=_Part_50111_24141780.1203586767396*"
    ------=_Part_50111_24141780.1203586767396--
    ------=_Part_50112_10709369.1203586767396
    Content-Type: application/octet-stream
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=somefile.bin
    ABCDEF.... //Some binary data
    ------=_Part_50112_10709369.1203586767396--
    It seems the webmailer creates an empty mailpart and only writes the end boundary (Line: ------=_Part_50111_24141780.1203586767396--).
    I know, the start boundary is really missing.
    I checked it out by getting a mailaccount from Arcor, and it always creates this structure when sending a message without a text. By the way, the Message-ID (header) generated from Arcor's server seems to be from javamail. (.....1234.567890.....JavaMail.ngmail@....).
    I don't know how many mailclients create "empty" parts, but impossible is nothing (e.g. other or future webmailer services).
    But how to handle?
    The error occures when calling MimeMultipart.getCount(), which causes to parse the mail if not parsed. All actions, which cause the mail to be parsed, will end in this exception (for this mail).
    I looked at the javamail source and found out, that the line of the empty part is not recognized as a boundary, because of its ending delimiters:
    if (line.equals(boundary))
    break;
    So the boundary is added to the preamble. It goes on with reading lines from the stream, until line == null.
    if (line == null)
    throw new MessagingException("Missing start boundary");
    Because there is no test, if the line matches the end boundary, it's not recognized. Wouldn't it be better in this case, to add an empty bodypart and set a variable to false (e.g. complete) instead of throwing an exception? Because MimeMultipart.parse() is called by other methods, like getCount, getBodyPart and writeTo, I can't nearly do anything automatically with the mail. How should i walk through the bodyparts and fetch the parts I'm interested in?
    Subclassing seems to be difficult to me:
    Object content = message.getContent();
    //javax.mail.Message, won't return a subclassed multipart
    if (content instanceof Multipart) {
    //recursive method!
    handleMultipart((Multipart) content); //collecting parts from multipart
    Of course, I could ask the laboratory: "please send me a greeting!" ;-)
    Greetings,
    cliff

    Interesting.
    Yes, it's probably a bug that JavaMail allows you to
    create a multipart with no body parts, since the
    MIME specification doesn't allow that. Still, the
    webmail application should be fixed so that it doesn't
    try to do that, at least including an empty plain text
    body part.
    Please contact the webmail provider and tell them of
    this bug in their application.
    I'll also look into making JavaMail cope with these
    broken messages more gracefully. Contact me
    at [email protected] and I'll let you know when
    I have a version ready to test.

  • How can I solve a "org.jvnet.mimepull.MIMEParsingException: Missing start boundary" when using "Page Attachments to Disk"?

    I have built a streaming MTOM enabled web service for downloading large files. I also built a client that uses that service (with MTOM and streaming feature). Everything works, when the client calls the web service directly.
    Then I have set up the OSB, so that I can call the service through the OSB. I have build a Business Service and a Proxy Service. For the Business Service, I use "XOP/MTOM Enabled", "Include Binary Data By Reference" and "Page Attachments to Disk" to prevent the OSB from loading the whole data into memory.
    If I do not use the "Page Attachments to Disk" option, the download works, but I assume everything is loaded into the OSB memory.
    When I use the "Page Attachments to Disk" option, I receive the following error message
    Exception in thread "main" com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Couldn't create SOAP message due to exception: org.jvnet.mimepull.MIMEParsingException: Missing start boundary Please see the server log to find more detail regarding exact cause of the failure.
        at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:193)
        at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:131)
        at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:253)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:203)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:290)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
        at com.sun.proxy.$Proxy38.fileDownload(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:87)
        at com.sun.proxy.$Proxy39.fileDownload(Unknown Source)
        at largefiletransfer_osb_client.MtomClientDownload.main(MtomClientDownload.java:59)
    Why do I get this exception and how can I solve the issue?
    Additional Infos:
    OS: Windows 7 64bit
    Tool: JDeveloper BPM Suite 12.1.3.0.0
    WebService: HTTP + SOAP + MTOM + Streaming

    I have built a streaming MTOM enabled web service for downloading large files. I also built a client that uses that service (with MTOM and streaming feature). Everything works, when the client calls the web service directly.
    Then I have set up the OSB, so that I can call the service through the OSB. I have build a Business Service and a Proxy Service. For the Business Service, I use "XOP/MTOM Enabled", "Include Binary Data By Reference" and "Page Attachments to Disk" to prevent the OSB from loading the whole data into memory.
    If I do not use the "Page Attachments to Disk" option, the download works, but I assume everything is loaded into the OSB memory.
    When I use the "Page Attachments to Disk" option, I receive the following error message
    Exception in thread "main" com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Couldn't create SOAP message due to exception: org.jvnet.mimepull.MIMEParsingException: Missing start boundary Please see the server log to find more detail regarding exact cause of the failure.
        at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:193)
        at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:131)
        at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:253)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:203)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:290)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
        at com.sun.proxy.$Proxy38.fileDownload(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:87)
        at com.sun.proxy.$Proxy39.fileDownload(Unknown Source)
        at largefiletransfer_osb_client.MtomClientDownload.main(MtomClientDownload.java:59)
    Why do I get this exception and how can I solve the issue?
    Additional Infos:
    OS: Windows 7 64bit
    Tool: JDeveloper BPM Suite 12.1.3.0.0
    WebService: HTTP + SOAP + MTOM + Streaming

  • Javax.mail.MessagingException: Missing start boundary

    I use the following code creates a Mime file
    MimeMultipart mmp = new MimeMultipart();
                   MimeBodyPart mbp = null;
                   // add rootpart
                   mbp = new MimeBodyPart();
                   mbp.setContentID("[email protected]");
                   mbp.setDataHandler(new DataHandler(new FileDataSource(args[0])));
                   mmp.addBodyPart(mbp);
                   // add attachment info
                   for(int i = 1; i < args.length; i = i+2){
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        GZIPOutputStream gos = new GZIPOutputStream(baos);
                        FileInputStream fis = new FileInputStream(args[i+1]);
                        byte[] bytes = new byte[1024];
                        int len;
                        while((len = fis.read(bytes, 0, 1024)) > 0){
                             gos.write(bytes, 0, len);
                        fis.close();
                        gos.close();
                        baos.close();
                        InternetHeaders ih = new InternetHeaders();
                        ih.addHeader("Content-ID", args);
                        mbp = new MimeBodyPart(ih, baos.toByteArray());
                        mmp.addBodyPart(mbp);
                   String CarriageReturn = String.valueOf(CARRIAGE_RETURN);
                   String lineFeed = String.valueOf(LINE_FEED);
                   String horizontaltab = String.valueOf(HORIZONTAL_TAB);
                   FileOutputStream fos = new FileOutputStream(args[0] + ".mime");
                   StringBuffer msgParam = new StringBuffer();
                   msgParam.append("MIME-Version: 1.0");
                   msgParam.append(CarriageReturn);
                   msgParam.append(lineFeed);
                   msgParam.append("Content-Type: ");
                   msgParam.append(mmp.getContentType().replaceAll(CarriageReturn,"").replaceAll(lineFeed,"").replaceAll(horizontaltab,""));
                   msgParam.append("; start=\"<[email protected]>\"");
                   msgParam.append(CarriageReturn);
                   msgParam.append(lineFeed);
                   msgParam.append(CarriageReturn);
                   msgParam.append(lineFeed);
                   msgParam.append(CarriageReturn);
                   msgParam.append(lineFeed);
                   fos.write(msgParam.toString().getBytes());
                   mmp.writeTo(fos);
                   fos.close();
    I can correctly read the mime file at windows OS,but in linux OS i got the following error Message:
    2010/11/19 11:53:40     K101J2EED1     fatal     0041EBFC124735B5B67FFA9F4B3B09961KD1     例外=[javax.mail.MessagingException: Missing start boundary]     
    sun.reflect.GeneratedMethodAccessor303.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    $Proxy28.execute(Unknown Source)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    jp.terasoluna.fw.web.struts.action.RequestProcessorEx.process(RequestProcessorEx.java:149)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:675)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:324)
    jp.co.nttdata.erc.sys.app.extended.ExtendedFilter.doFilter(ExtendedFilter.java:163)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:424)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:324)
    jp.co.nttdata.erc.sys.app.extended.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:174)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:424)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:324)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:379)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.catalina.core.LinkedPipeline.invoke(LinkedPipeline.java:475)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:983)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:349)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.tcg.ThreadControlGroupValve.invoke(ThreadControlGroupValve.java:82)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.ejb.management.mbean.web.RequestStatisticsValve.invoke(RequestStatisticsValve.java:72)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:188)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.catalina.core.StandardSessionValve.invoke(StandardSessionValve.java:96)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.catalina.core.LinkedPipeline.invoke(LinkedPipeline.java:475)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:983)
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:3928)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:261)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:197)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.catalina.core.LinkedPipeline.invoke(LinkedPipeline.java:475)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:983)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    com.hitachi.software.web.catalina.core.ValveWrapper.invokeNext(LinkedPipeline.java:672)
    com.hitachi.software.web.catalina.core.LinkedPipeline.invoke(LinkedPipeline.java:475)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:983)
    org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:700)
    org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:959)
    java.lang.Thread.run(Thread.java:620)
    Edited by: chengen on Nov 24, 2010 8:26 PM
    Edited by: chengen on Nov 24, 2010 9:25 PM

    I can correctly read the mime file at windows OS,but in linux OS i got the following error Message:That would suggest one or more of the following.
    1. An end of line problem. Something is wrong with your use of CR/LF.
    2. A line length problem (brief look suggests a 998 limit.)
    3. One reader is more lenient than the other. This goes back to 1 and 2.

  • Correct way to copy Multipart and prevent Missing start boundary Exception

    Hi there
    I've worked through the FAQ's and forum and based on the info available tried to construct code to deal with the whole "javax.mail.MessagingException: Missing start boundary" problem. I keep on getting a ClassCastException though and was hoping you could scan through the code and let me know if you see anything. I must be missing something ... simplified extract of code below:
    Multipart mp = (Multipart)part.getContent();
    try {
         for (int i = 0; i < mp.getCount(); i++) {
              processBodyPart(wrapper, mp.getBodyPart(i), i);
    } catch (MessagingException e) {
         // Converting Msg to a Copy (to fix boundary)
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         part.writeTo(bos);
         byte[] bytes = bos.toByteArray();
         MimeMessage newMsg = new MimeMessage(emailAccount.getSession(), new ByteArrayInputStream(bytes));
         String ct = newMsg.getContentType();
         newMsg.removeHeader("Content-Type");
         ct = ct.substring(0, ct.indexOf(";")); // Strip out the rest, only retain the content-type
         newMsg.setDataHandler(new DataHandler(newMsg.getContent(), ct));
         Multipart testMp = (Multipart)newMsg.getContent(); // <<-------- ClassCastException here!!
         for (int i = 0; i < testMp.getCount(); i++) {
              Part bp = testMp.getBodyPart(i);
              processBodyPart(bp);
    }Much appreciated.
    Marius

    I took out the truncating part to make the example shorter,
    but I did try both keeping it as it was, as well as truncating
    it (it is "multipart/mixed") with the same effect.
    I was able to save the entire message to file (thanks), attached
    below - maybe you can spot something that could be causing it?
    Thanks again.
    X-Original-To: [email protected]
    Delivered-To: [email protected]
    Received: from mail.adept.co.za (localhost [127.0.0.1])
         by mail.adept.co.za (Postfix) with ESMTP id E3074C03D9
         for <[email protected]>; Fri, 18 Jan 2008 14:35:29 +0200 (SAST)
    X-Greylist: from auto-whitelisted by SQLgrey-1.7.4
    Received: from mail-03.jhb.wbs.co.za (mail-03.jhb.wbs.co.za [196.2.97.2])
         by mail.adept.co.za (Postfix) with ESMTP id CA3AEC03D7
         for <[email protected]>; Fri, 18 Jan 2008 14:35:28 +0200 (SAST)
    Received: from localhost by mail-03.jhb.wbs.co.za;
      18 Jan 2008 14:35:28 +0200
    Date: 18 Jan 2008 14:35:28 +0200
    To: [email protected]
    From: "Mail Delivery System" <[email protected]>
    Subject: Delivery Status Notification (Failure)
    MIME-Version: 1.0
    Content-Type: multipart/report; report-type=delivery-status; boundary="9sdJO.4G/vWebcc.bcm9J.Ak/cwPA"
    Message-Id: <[email protected]>
    X-Virus-Scanned: ClamAV Passed
    X-Spam-Scanned: -1.4
    X-Scanned-By: proxfilter
    --9sdJO.4G/vWebcc.bcm9J.Ak/cwPA
    content-type: text/plain;
        charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    The following message to <[email protected]> was undeliverable.
    The reason for the problem:
    5.1.2 - Bad destination host 'DNS Hard Error looking up onyxit.co.za (MX): =
    NXDomain'
    --9sdJO.4G/vWebcc.bcm9J.Ak/cwPA
    content-type: message/delivery-status
    Reporting-MTA: dns; jnb-mailfw01.wbs.co.za
    Final-Recipient: rfc822;[email protected]
    Action: failed
    Status: 5.0.0 (permanent failure)
    Diagnostic-Code: smtp; 5.1.2 - Bad destination host 'DNS Hard Error looking up onyxit.co.za (MX):  NXDomain' (delivery attempts: 0)
    --9sdJO.4G/vWebcc.bcm9J.Ak/cwPA
    content-type: message/rfc822
    Received: from wbs-smtp-out-02.jhb.wbs.co.za (HELO wbs-smtp-out-02) ([196.2.97.197])
      by mail-03.jhb.wbs.co.za with ESMTP; 18 Jan 2008 14:35:28 +0200
    Received: from wbs-smtp-out-02.jhb.wbs.co.za (HELO wbs-smtp-out-02) ([196.2.97.197])
      by mail-03.jhb.wbs.co.za with ESMTP; 18 Jan 2008 14:35:28 +0200
    Received: from wbs-41-208-227-16.wbs.co.za ([41.208.227.16] helo=jnfsworkpool)
         by wbs-smtp-out-02 with esmtp (Exim 4.67)
         (envelope-from <[email protected]>)
         id 1JFqSK-0000qy-8m; Fri, 18 Jan 2008 14:36:30 +0200
    Date: Fri, 18 Jan 2008 14:35:10 +0200 (SAST)
    From: Ros Copeling <[email protected]>
    To: [email protected]
    Cc: [email protected]
    Message-ID: <[email protected]>
    Subject: FW: Fw: Message from ESKOM
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="----=_Part_16_32195616.1200659710788"
    X-Priority: 3
    Importance: normal
    Sensitivity: Normal
    workpool_message_id: 6879
    X-Original-Subject: FW: Fw: Message from ESKOM
    X-Spam-Ignored: [TOO LARGE] Message > 100K
    X-Scan-Signature: 66244f1a8ccb48c519852bcb33c1a261
    --9sdJO.4G/vWebcc.bcm9J.Ak/cwPA--

  • .MessagingException - Missing start boundary when loading a mail twice

    Hi!
    I have found a very interesting behaviour. When parsing a multipart mail twice, there is an error "javax.mail.MessagingException: Missing start boundary". This happens for every multipart mail which is fetched via POP3 and seems to be independant of both POP3 Server and the mail client the message was built with.
    Environment:
    debian linux, amd64, java 1.6
    latest javamail from https://hg.kenai.com/hg/javamail~mercurial
    Test program:
    import java.io.*;
    import javax.mail.*;
    public class Mailtest {
         private final static void loadMail(Part p) throws Exception{
              Object content = p.getContent();
              if (content instanceof Multipart) {
                   Multipart mp = (Multipart) content;
                   int cnt = mp.getCount();
                   for (int u=0;u<cnt;u++) {
                        loadMail(mp.getBodyPart(u));
         public final static void main(String[] args) throws Exception {
              //System.setProperty("mail.mime.cachemultipart", "true");
              java.util.Properties props = new java.util.Properties();
              Session mailSession = Session.getInstance(props, null);
              Store store = mailSession.getStore("pop3");
              store.connect("pop3srv", 110, "username", "pwd");
              Folder folder = store.getFolder("INBOX");
              folder.open(Folder.READ_WRITE);
              Message[] msgs = folder.getMessages();
              for (int i=0;i<msgs.length;i++) {
                   /*if (msgs[i] instanceof com.sun.mail.pop3.POP3Message) {
                        System.out.println("inputstream");
                        InputStream in = msgs.getDataHandler().getInputStream();
                        in.close();
                   System.out.println("i=" + i + " try = 1");
                   loadMail(msgs[i]);
                   System.out.println("i=" + i + " try = 2");
                   loadMail(msgs[i]);     
    Output:
    i=0 try = 1
    i=0 try = 2
    Exception in thread "main" javax.mail.MessagingException: Missing start boundary
    at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:882)
    at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:503)
    at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:244)
    at testapp.Mailtest.loadMail(Mailtest.java:11)
    at testapp.Mailtest.main(Mailtest.java:38)
    Java Result: 1
    I thought that the 2 code blocks which are commented might be a workaround, but nothing changed if both blocks are active.
    BTW: What is "mail.mime.multipart.bmparse" supposed to do?

    Yes, thank you, that's a bug introduced in the (not yet final) JavaMail 1.4.4 release.
    I've fixed it. I'll push the fix soon.
    mail.mime.multipart.bmparse is a property to control whether the old (slow) multipart parser
    is used, or the new (fast) Boyer-Moore multipart parser is used.

  • Multipart/report - Missing Start Boundary - MultiPart.getContent()

    I am writing to you in regard to an issue that I have been facing recently, and I wanted to see if the JavaMail developers / community could provide any answers.
    Does JavaMail support the multipart/report MIME specification (RFC 1892)?
    The reason I ask, is that I have seen a strong correlation between errors in JavaMail and this content....
    I am getting Missing Start Boundary exceptions when I execute this code on a message that has this Mime Type in it, (multipart/report)
    mp = (Multipart)part.getContent();
    count = mp.getCount(); // THIS IS WHAT THROWS THE ERROR
    An example of this message header, would be
    X-Atlas-MailScanner-From: [email protected]
    Content-Type: multipart/report; report-type=delivery-status;
    boundary="==IFJRGLKFGIR5607UHRUHIHD"
    ** NOTE HOW BOUNDARY IS SPECIFIED UNLIKE THE OTHER SECTIONS WHICH LEADS ME TO BELIEVE THE MISSING START BOUNDARY EXCEPTION **
    --==IFJRGLKFGIR5607UHRUHIHD
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: base64
    --==IFJRGLKFGIR5607UHRUHIHD
    Content-Type: message/rfc822
    I have seen older posts that talk about other people's problem regarding this Exception; however, have not seen an abstract way for circumventing the issue.
    Any insight/future development intentions/experience in dealing with this issue would be greatly appreciated.
    RR

    I'm getting the same exception on several "bounce" messages I try to access with JavaMail. I believe that some of them are flat-out wrong in their MIME encoding, as there truly is no start boundary. However, some appear to be OK and causing JavaMail to give an exception. Should this be logged as a bug?
    Here's an example similar to yours (I didn't include all the received headers and several addresses are munged):
    <blockquote><i>{noformat}Date: Sat, 19 Apr 2008 06:57:46 -0400
    From: [email protected]
    Subject: Undelivered mail
    To: x
    Message-ID: <[email protected]>
    MIME-Version: 1.0
    Content-Type: multipart/report; report-type=delivery-status;
            boundary="--TKFLZMMSbcaBDNCJdCBMaXGSRbVIAF"
    --TKFLZMMSbcaBDNCJdCBMaXGSRbVIAF<br />
    --> Error description:
    Error-For: [email protected]
    Error-Code: 5.1.1
    Error-Text: No such list.
    Error-End: One error reported.
    --TKFLZMMSbcaBDNCJdCBMaXGSRbVIAF<br />
    Content-Type: message/delivery-status
    Reporting-MTA: dns; LISTS.NETSPACE.ORG
    Final-Recipient: RFC822; [email protected]
    Action: failed
    Status: 5.1.1 (No such list)
    --TKFLZMMSbcaBDNCJdCBMaXGSRbVIAF<br />
    Content-Type: message/rfc822
    Return-Path: <x>
    X-Original-To: [email protected]
    Received: from ppp91-122-170-233.pppoe.avangarddsl.ru (ppp91-122-170-233.pppoe.avangarddsl.ru [91.122.170.233]) by lists.netspace.org (Postfix) with ESMTP id 538527A53A for <[email protected]>; Sat, 19 Apr 2008 06:57:45 -0400 (EDT)
    Received: from [91.122.170.233] by mx1.bne.server-mail.com; Sat, 19 Apr 2008 14:06:15 +0300
    Message-ID: <01c8a226$87bfa580$e9aa7a5b@retentioncal53>
    From: "x" <x>
    To: <[email protected]>
    Subject: The extracts of VPXL are Pueraria tuberose 75 mg, Mucuna pruriens 75 mg, Asteracantha longifolia 75 mg.
    Date: Sat, 19 Apr 2008 14:06:15 +0300
    MIME-Version: 1.0
    Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original
    Content-Transfer-Encoding: 7bit
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Mailer: Microsoft Outlook Express 6.00.2741.2600
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2741.2600
    TKFLZMMSbcaBDNCJdCBMaXGSRbVIAF{noformat}
    </i></blockquote>

  • Missing start Boundary exception

    Hi all,
    I am evaluating an e-mal archiving software that utilizes javamail. I am getting a high number of messages that don't get archived, due to the Missing start Boundary exception.
    Now I know, that often times e-mail messages don't get correctly constructed, but the sheer number of rejected messages really struck me.
    So I gathered a message and loaded it into a text editor to check the boundary structure myself.
    I have stripped the message down to reflect the boundary structure and I would like to know, if I missed anything, but I can't find out why javamail complains about a missing start boundary.
    I could post the complete message as well, if my example should not be suitable for examining this issue.
    So, here we go:
    Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms020608030602020702090804"
         This is a cryptographically signed message in MIME format.
         --------------ms020608030602020702090804
         Content-Type: multipart/mixed; boundary="------------070406040008020802000107"
              This is a multi-part message in MIME format.
              --------------070406040008020802000107
              Content-Type: text/plain; charset=ISO-8859-1; format=flowed
              Content-Transfer-Encoding: quoted-printable
              Test f=FCr mailArchiva III
              --------------070406040008020802000107
              Content-Type: multipart/alternative; boundary="============_CoolerEmail_============"
                   Date: Wed, 23 Apr 2008 07:41:31 -0700
                   --============_CoolerEmail_============
                   Content-Transfer-Encoding: binary
                   --============_CoolerEmail_============
                   Content-Transfer-Encoding: binary
                   Content-Type: text/html; charset="iso-8859-1"
              --============_CoolerEmail_============--
         --------------070406040008020802000107--
         --------------ms020608030602020702090804
    --------------ms020608030602020702090804--
    Thanks,
    Stephan

    Hi Bill,
    well, yes. It's one of a huge amount of messages being rejected. Actually I am not a programmer, but I try to deal with an archiving solution called mailArchiva. This software uses javamail and the mails get into the software using a postfix milter.
    I wanted to make sure that my gateways don't mess up these messages, prior getting into negotiation with the developer about what could be wrong along the way.
    I will now contact him and see, if I can get any more logs from the software.
    Thanks,
    Stephan

  • File Transfer (Missing start of file)

    Hi there, I'm undertaking part of a software project at University and struggling to fix a piece of code myself and a friend have wrote after exhausing most of the good java programmers in our department.
    We're simply trying to send files over a network via TCP, the main problem we're encountering is that if we send say a text file, a varying number of characters will appear missing. Normally we'll recieve between 300-400 of the 500 bytes we send for example, and these characters are always missing from the start of the file. Obviously this is the bit we need to fix, at the end we're aiming to be able to send media files (jpg, gif, txt, wav, avi) and hopefully objects aswell.
    The way its intended to work at present is that the server sends file information to the client (filename and filesize), and then the client listens, and writes the same number of bytes as the filesize to the new file it creates (though I'm sure you'll work that out in seconds). The file has been read in, and wrote back on the server side just to ensure the reading/sending section was working which it was.
    Server Side:
    FileServer.java: import java.io.*;
    import java.net.*;
    public class FileServer
       private ServerSocket serverSocket = null;
       private Socket socket = null;     
       public String fileDir = "H:/JAVA/";
       public String fileName = "text.txt";
       public String filePath = fileDir + fileName;
       public PrintWriter log;
       public BufferedReader in;
       public PrintStream out;
       public FileServer() throws IOException
          try {
                  serverSocket = new ServerSocket(1138);
                  System.out.println("Server initialised and listening on port : 1138.");
          catch (IOException e){
             System.out.println("Could not listen on port : 1138");
          try {
             socket = serverSocket.accept();
             System.out.println("Client" + serverSocket.getInetAddress() + "connected.");
             in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
             out = new PrintStream(socket.getOutputStream(), true);
          catch (IOException e){
             System.out.println("Could not accept client.");
             System.exit(1);
         boolean done = false;
         while (!done)
            try{
               String line = in.readLine();               
               if (line == null)
                  done = true;
              else
                   if (!line.trim().equals("CLOSE"))               
                       if (line.trim().equals("SEND FILE"))
                           sendFile(filePath, socket);
                   else
                       done = true;                         
                catch (IOException e) {
                   System.out.println("Cannot read data from client");
                   System.exit(1);
          socket.close();
    public void sendFile( String filename, Socket socket )
       File file;     
       try{
             file= new File(filePath);
             int c =0;
             FileInputStream fis = new FileInputStream(file);
             out.println(fileName+":"+file.length());
             OutputStream os = socket.getOutputStream();
             int i = 0;
             while((c = fis.read()) != -1)
                 i++;
                System.out.println(i +"  "+ c);
                os.write(c);
             System.out.println("File "+filePath+" sent:"+file.length());
             fis.close();
       catch( Exception e ) {
            System.out.println("sending file error");
            e.printStackTrace();
            System.exit(1);
    public static void main (String [] args) throws IOException
       FileServer myFileServer = new FileServer();
    Client Side:
    Client.java: import java.net.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Client
      private Socket clientSocket = null;
      public String filePath = "H:/java/Temp";
      PrintWriter out = null;
      BufferedReader in = null;
      String host = "144.32.152.154";
      int port = 1138;
      Integer fileSize;
      String filename;
      public Client() throws IOException {
        InputStream inputStream;
        try {
          clientSocket = new Socket(host, port);
        catch (IOException e) {
          System.out.println("Could not create connection");
          System.exit(1);
        out = new PrintWriter(clientSocket.getOutputStream(), true);
        inputStream = clientSocket.getInputStream();
        in = new BufferedReader(new InputStreamReader(inputStream));
        out.println("SEND FILE");
       String details;
       while((details = in.readLine()) != null)     
          System.out.println(details);
          StringTokenizer sToken = new StringTokenizer(details, ":");
          filename = sToken.nextToken();
          fileSize = Integer.valueOf((sToken.nextToken()));
          System.out.println(filename);
          System.out.println(fileSize);
          FileOutputStream file = new FileOutputStream(new File(filePath,filename));
             for (long i=0; i<fileSize.longValue(); i++)
                int c = inputStream.read();
                file.write(c);
                System.out.println(i);
                System.out.println(fileSize);
            System.out.println("Exited Loop");
            file.flush();
            file.close();
            clientSocket.close();
            System.out.println("The End");
            System.exit(-1);
      public static void main(String[] args) throws IOException
        Client myClient = new Client();
    } I'd appreciate any help you can offer to fix the problem! Thanks
    Ian Wright

    OK. There were some mistakes in the code. Some made by me, some by you.
    First of all: The byte array which acts as a buffer for reading the file content from the socket cannot have the size of the whole file. Normally it is suggested to set to 8-32kB.
    Second thing: I was too fast in giving you the idea of reading the details only once to an array. Sometimes the Client program is faster than the FileServer and although the array has space for "nameLength" bytes it reads a lot less. That way the details aren't recieved properly. To solve this I've added a loop that waits for the inputStream to retrieve enought data.
    Last but not least: I've been told that it is not wise to close the socket at the server side. If you close the socket the OutputStream is cut off without a warning. Close the OutputStream instead.
    I remember that you asked me to reply via e-mail but I think that posting the solution here will be more usfull to others. Here's the code:
    Client3.java
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class Client3
      private Socket clientSocket = null;
      OutputStream out;
      public String filePath = "E:/";
      String host = "127.0.0.1";
      int port = 1138;
      Integer fileSize;
      String filename;
      static final byte SEND = 1;
      static final byte DONE = 2;
      static final byte ERROR = 0;
      public Client3()throws IOException{
        DataInputStream inputStream;
        System.out.println("Hello");
        try {
          clientSocket = new Socket(host, port);
        catch (IOException e) {
          System.out.println("Could not create connection");
          System.exit(1);
        out = clientSocket.getOutputStream();
        inputStream = new DataInputStream(clientSocket.getInputStream());
        out.write(SEND);
         byte nameLength = (byte)inputStream.read();
         byte[] nameArray = new byte[nameLength];
         while (inputStream.available()<nameLength) // we have to wait for the details to arrive :]
              try {
                   Thread.sleep(10);
              } catch (InterruptedException e) {
                   System.out.println("Client impatient ... couldn't wait");
              inputStream.read(nameArray);
         String details = new String(nameArray);
         StringTokenizer sToken = new StringTokenizer(details, ":");
        filename = sToken.nextToken();
        fileSize = Integer.valueOf((sToken.nextToken()));
         System.out.println(filename+":"+fileSize);
          FileOutputStream file = new FileOutputStream(new File(filePath,filename));
                   while (true) { // now read the file one piece after a nother :P
                        byte[] fileBuffer = new byte[8*1024];
                        int cnt = 0;
                        cnt = inputStream.read(fileBuffer);
                        if (cnt==-1) break;
                        file.write(fileBuffer,0,cnt);
          file.flush();
          file.close();
          out.close(); // T100 would say: Hasta la vista ... baby!
          System.out.println("The End");
          System.exit(-1);
      public static void main(String[] args) throws IOException{
           Client3 client = new Client3();
    FileServer3.java
    import java.io.*;
    import java.net.*;
    public class FileServer3 {
       private ServerSocket serverSocket = null;
       private Socket socket = null;     
       public String fileDir = "";
       public String fileName = "image.bmp";
       public String filePath = fileDir + fileName;
       public PrintWriter log;
       public InputStream in;
       public DataOutputStream out;
       static final byte SEND = 1;
       static final byte DONE = 2;
       static final byte ERROR = 0;
       public FileServer3() throws IOException
          try {
                  serverSocket = new ServerSocket(1138);
                  System.out.println("Server initialised and listening on port : 1138.");
          catch (IOException e){
             System.out.println("Could not listen on port : 1138");
        while(true){
          try {
             socket = serverSocket.accept();
             System.out.println("Client" + serverSocket.getInetAddress() + "connected.");
             in = socket.getInputStream();
             out = new DataOutputStream(socket.getOutputStream());
          catch (IOException e){
             System.out.println("Could not accept client.");
             System.exit(1);
          try{
               byte b =(byte)in.read();
              if (b == SEND)               
                           sendFile(filePath, out);
           catch (IOException e) {
                   System.out.println("Cannot read data from client");
                   System.exit(1);
    public void sendFile( String filePath, DataOutputStream out ) {
         File file;
       try{
         file = new File(filePath);
             FileInputStream fis = new FileInputStream(file);
         String details = fileName+":"+Long.toString(file.length());
         System.out.println((byte)details.length()+": "+details);
         out.write((byte)details.length());
         out.writeBytes(details);
         System.out.println("File details sent");
         while (true) { // Momma always said to bite before swallowing :D
              byte[] byteArray = new byte[8*1024];
              int cnt = fis.read(byteArray);
              if (cnt == -1) break;
              out.write(byteArray,0,cnt);
             System.out.println("File "+filePath+" sent:"+file.length());
             out.close(); // Say goodbye and the door will close by it self %)
       catch( Exception e ) {
            System.out.println("sending file error");
            e.printStackTrace();
            System.exit(1);
      public static void main (String [] args) throws IOException {
         FileServer3 myFileServer = new FileServer3();
    }I hope this will help you out. If there are any other errors that I've missed than point them out to me and I'll se what can be done later. I have a cake in the oven and don't have enough time right now :].
    ...:: byElwiZ ::...

  • Missing Start DLL

    I bought a new Officejet 4830 when my Officejet 6700 died I unustalled all of the 6700 programs but now I'm getting an error message :
    There was a problem starting c:\Program Files\HP\HP Officejet 6700\bin\HPStatusBL.dll
    The specified module could not be found
    I have used every toll I have to check the startup programs, and cannot find the entry for this one. Can anyone help?
    This occurs every time Windows is restarted. I am running Windows 7 Home Premium, and it is fully updated.
    This question was solved.
    View Solution.

    Mia1963 wrote:
    I am experiencing the same problem and even calling HP US i have not found a fix. I restored my computer to an earlier restore point it got rid of the error, but the 6700 is back on my system, not what I wanted. Have you found a fix as of yet? Please  inform
    I re-installed the 6700 software, told it I would attach printer later, copied the .dll to a hold folder and then uninstalled the 6700 software. Same error, so I created the missing folder in Program Files, copied the .dll to the location specified in the message (you will have to create all the folders) and the message disappeared. Everything else is gone. Just have to keep that dummy file around.

  • Missing Start Up Programs

    Hello,
    I uninstalled a program (Shellless) and rebooted pc,but  no programs run on system start up and no icons appear in system tray  (I mean the programs which normally should run on start up, such as antivirus, messenger, firewall ...). How can I fix this problem?

    I had a similar problem where the start menu, taskbar and icons gone missing.  I had to use the task manager to terminate explorer.exe and create it as a new task.  But still, missed items did not show up but found to be necessary to prevent system becoming very slow.
    I think the solution outlined in http://support.microsoft.com/kb/962963 is necessary.  That, combined with uninstalling and reinstalling the anti-virus tool fixed the problem for me.  

  • Missing "Start New Session"

    What the subject line says.
    Since last week the "Start New Session" option has been missing.
    "Restore Previous Session" and "Close" are intact.

    hello SirSimeon2003, i the "start new session" button has simply been relabeld "close" in this scenario.
    https://bugzilla.mozilla.org/show_bug.cgi?id=523140

  • Missing start display

    My start button and display bar on the bottom of my desktop are missing.  How do I restore? 

    My start button and display bar on the bottom of my desktop are missing.  How do I restore? 

  • Audio misses starting on time

    Hi, the title is a bit vague, but here is the problem
    We are running FMS 4.03 (updated form 4.0) and at the same time we moved from 32 bit to 64 bit, AND we moved our app and data to the D drive
    we stream (we have radio stations across the globe) by people out at a high quality.
    since the move, the songs, promos, etc do not start at the start. Sometimes they are okay, but for many it misses the first few seconds - or as people now describe it as a 'hicup'.
    went through the forum/help and increased the chunk size (from 4096 to 8192) in FMS.ini, and the cache flv size (from 500 to 2000) in Applications.xml
    but it is 'still' happening.
    any help wopuld be appreciated.
    also if there is someone who is good at FMS and is very reasonable in charging as we are strapped for cash that can look at what we are **** that would also be great.

    The "hiccups' continue but not for all
    changed in Application.xml :
    OutChunkSize = 8192
    turned off aggregated messages
    increased runtime size to 16384
    queue - off
    changed in FMS.ini:
    FLV Cache = 2000
    anyone have any ideas to stop the stream hiccups as it would be much appreciated.
    moving the app and data to a D drive wouldnt make any difference would it?
    forgot to mention Im running it on Windows 2008 R2 32Gb RAM Quad 3.4Ghz  (1Gb connection) and FMS 4.03

  • I am missing starting a new tabpage direct with my startpage

    I changed from 3.6 to 4.01
    -I now miss a knob for starting a new tabpage direct with my (Google)startpage.
    -From an earlier version (2?) I also and still miss the possibility of making a new tabpage with a copy (including history) of the current page.

    I changed from 3.6 to 4.01
    -I now miss a knob for starting a new tabpage direct with my (Google)startpage.
    -From an earlier version (2?) I also and still miss the possibility of making a new tabpage with a copy (including history) of the current page.

Maybe you are looking for