This discussion is archived
2 Replies Latest reply: May 25, 2011 4:24 PM by 850650 RSS

OrdHttpUploadFormData.parseFormData() failed within Struts2 action class

850650 Newbie
Currently Being Moderated
I got the example servlet PhotoAlbumServlet.java works just fine. So the setup should be good. However, when I need to get upload photo work with Struts2, I got error:

[5/24/11 17:08:30:189 PDT] 00000020 webapp E com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Servlet Error]-[IMW-00005: end-of-stream; client terminated request (or invalid Content-Length)]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: IMW-00005: end-of-stream&#59; client terminated request (or invalid Content-Length)

at parseFormData();

The the request form is fine, since I use same request form and changed the action to point to the demo servlet and it works. So I copy the worked servlet code into my action class and debuged into the code. It failed at parseFormData();
Here is my action class code:

public String execute() throws Exception {
OrdHttpUploadFormData formData = new OrdHttpUploadFormData( request );

if ( !formData.isUploadRequest() )
{
     System.out.println("Not upload request!!");
return INPUT;
}

formData.parseFormData();  // <= this step failed.
...
...
}

So, I guess that struts2 may alternated request object which make the parse failed.

Has Anyone used ORD work with Struts successfully before? Or if possible that I can get source code of this OrdHttpUploadFormData so that I can debug into it and see what's going on?

Is there any other alternation or work around for this?

Thanks in advance for any tips.

Regards,

Joe
  • 1. Re: OrdHttpUploadFormData.parseFormData() failed within Struts2 action class
    850650 Newbie
    Currently Being Moderated
    By add try - catch block to the parseFormData:

    try {
         formData.parseFormData();
    } catch (Exception e) {
         e.printStackTrace();
    }

    I got:

    [5/25/11 8:28:20:489 PDT] 00000024 SystemErr R oracle.ord.im.OrdHttpUploadException: IMW-00005: end-of-stream; client terminated request (or invalid Content-Length)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartInputStream.read(OrdMultipartInputStream.java:92)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartReader.readLine(OrdMultipartReader.java:152)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartReader.readCheckDelimiter(OrdMultipartReader.java:132)

    ...
  • 2. Re: OrdHttpUploadFormData.parseFormData() failed within Struts2 action class
    850650 Newbie
    Currently Being Moderated
    With following code inaction class, I can easily get the image data uploaded and save it to local file:

    public String execute() throws Exception {

    String fullFileName = "c:/temp/test1.JPG";

    File theFile = new File(fullFileName);

    FileUtils.copyFile(path, theFile);
    ...

    So, clearly there is something incompatible between Struts2 and Oracle Multimedia. Without source I can not trace into the parseFormData() to find out what's going on in it. So, what other alternation we have? Manually create ORDImage object?

    Thanks in advance for advices,

    Joe Huang

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points