My project had the same stack. I can explain why this is happening, and several ways to fix it.
richfaces fileUpload , InputStream . ,
request.getParameter(anyParamName) multipart- request.getParts().
filesupload - , , ( tomcat) -1; , richfaces , .
, , multipart- inputStream.
richfaces, MultipartRequest25 MultipartRequestParser.
MultipartRequestParser, , FileUploadParam. , .
jboss jira , , , . . . https://issues.jboss.org/browse/RF-13061
public void parse() throws FileUploadException {
try {
initialize();
while (!sequenceMatcher.isEOF()) {
readNext();
}
} catch (IOException e) {
if(e.getMessage().equals(REQUEST_PROLOG_CANNOT_BE_READ)){
try {
if(request.getParts()!=null && request.getParts().size()>0){
Collection<Part> parts = request.getParts();
for(Part part:parts){
String headersString = part.getHeader("content-disposition");
Multimap<String, String> headers = LinkedListMultimap.create();
String[] split = headersString.split("\r\n");
for (String headerString : split) {
parseParams(headerString, "; ", headers);
}
FileUploadParam param = createParam(headers);
if (param == null) {
continue;
}
param.create();
try{
int size = (int)part.getSize();
byte[] buf = new byte[size];
part.getInputStream().read(buf, 0, size);
param.handle(buf, size);
}finally{
param.complete();
}
if (param.isFileParam()) {
uploadedFiles.add(new UploadedFile25(param.getName(), param.getResource(), headers));
} else {
parametersMap.put(param.getName(), param.getValue());
}
}
return;
}
} catch (Exception e1) {
this.cancel();
throw new IllegalStateException("Could get Parts from the request", e1);
}
}
this.cancel();
throw new FileUploadException(MessageFormat.format("Exception parsing multipart request: {0}", e.getMessage()), e);
}
}
>