Advertisement

03.17.2008 at 12:21PM PDT, ID: 23248131
[x]
Attachment Details

oreilly MultipartRequest Throwing exception whil uploading file

Asked by zmoidin in Java Programming Language, Apache Web Server, WebApplications

Tags: java.io.IOException: unexpected end of part

I am trying to upload files to my server using oriellys MultipartRequest.

I seem to get the following exception at random times

[2008-03-17 12:59:13,656] java.io.IOException: unexpected end of part
at com.oreilly.servlet.multipart.PartInputStream.fill(PartInputStream.java:100)
at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:183)
at com.oreilly.servlet.multipart.PartInputStream.read(PartInputStream.java:156)
at com.oreilly.servlet.multipart.FilePart.write(FilePart.java:208)
at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:167)
at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:266)

The code that causes this error is
MultipartRequest mReq;
            try {
                  mReq = new MultipartRequest(request, FileUtil.getSharedTmpDir().toString(),
                        MAX_FILE_BYTE_SIZE, Encoding.STRING_ENCODING, RENAMER);
}

The real problem is that, the upload works sometimes and sometimes throws this error. It seem to throw error more often when I upload large files(>100K) but not always. It seems browser specific some times( works mostly in IE) fails mostly with Firefox.. but not consistent.

I am using Tomcat6.0 (standalone)
AJP13

some more information about how I send this request.
I send this request through ajax call in javascript . See code snipper




I googled about this issue and found that its a AJP13 bug. I am not able to find how to fix this.
Any suggestion or help is greatly appreciated. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
var theDiv = document.createElement('div');
    theDiv.style.display = 'none';
    theDiv.innerHTML ='<iframe id="hidden_frame" name="hidden_frame" src=""></iframe>' +
    '<form id="hidden_form" target="hidden_frame" action="../servlet/Ajax?cmd=fileUpload" enctype="multipart/form-data" method="post"></form>';
 
    document.body.appendChild(theDiv);
    var hiddenForm = document.getElementById("hidden_form");
    fileParent.removeChild(theFile);
 
    // attach the file to the hidden form  and submit 
    hiddenForm.appendChild(theFile);
    hiddenForm.submit();
    rbf_callServer();
    hiddenForm.removeChild(theFile);
 
 
callServer()
{
m_ajaxRreq = getXMLHTTPRequest();
 	if (m_ajaxRreq) {
 		var url = getAjaxURL()+'&cmd=uploadStatus';	
 		
 		//create an local copy of the request to handle response in case of multiple requests
 		m_ajaxRreq.onreadystatechange = function () { doUpload(m_ajaxRreq); }
 		m_ajaxRreq.open("GET", url, true);		
 		m_ajaxRreq.send(null);
}
 
}
[+][-]03.18.2008 at 11:00PM PDT, ID: 21158833

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.23.2008 at 07:01AM PDT, ID: 21189647

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.23.2008 at 09:53PM PDT, ID: 21192009

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 03:40AM PDT, ID: 21192717

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 03:42AM PDT, ID: 21192723

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 10:04AM PDT, ID: 21194870

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 12:42PM PDT, ID: 21196218

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 06:07PM PDT, ID: 21198816

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.24.2008 at 10:22PM PDT, ID: 21199638

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 12:02AM PDT, ID: 21219120

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Apache Web Server, WebApplications
Tags: java.io.IOException: unexpected end of part
Sign Up Now!
Solution Provided By: zmoidin
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628