This discussion is archived
2 Replies Latest reply: Feb 2, 2011 4:55 AM by 835885 RSS

Multipart big file upload java.lang.OutOfMemoryError: Map failed

835885 Newbie
Currently Being Moderated
Hi everybody,

I have developed a simple file upload servlet to send a file from a server to another. It works fine but when I try it with a big file of >600MB I get the following exceptions:

2011-02-01 15:03:00,328 ERROR [pool-5-thread-3] com.servoy.j2db.util.Debug - Throwable Map failed
     at Source)
     at Source)
     at Source)
     at com.servoy.extensions.plugins.file.FileProvider.js_copyFile(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.mozilla.javascript.MemberBox.invoke(
     at org.mozilla.javascript.Interpreter.interpretLoop(
     at org.mozilla.javascript.Interpreter.interpret(
     at org.mozilla.javascript.ContextFactory.doTopCall(
     at org.mozilla.javascript.ScriptRuntime.doTopCall(
     at com.servoy.j2db.scripting.ScriptEngine.executeFunction(
     at com.servoy.j2db.plugins.ClientPluginAccessProvider$
     at com.servoy.j2db.server.headlessclient.SessionClient.invokeAndWait(
     at com.servoy.j2db.server.headlessclient.SessionClient.invokeLater(
     at com.servoy.j2db.plugins.ClientPluginAccessProvider$
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
     at java.util.concurrent.ThreadPoolExecutor$ Source)
     at Source)
Caused by: java.lang.OutOfMemoryError: Map failed
     at Method)
     ... 24 more

Here is my code:

               String filename = request.getParameter("filename");
               String serverName = request.getParameter("serverName");
               String uri = serverName+"/AGReceiverServlet";
               File file = new File((this.getServletContext().getRealPath("/sync/out"))+"\\"+filename);
               PostMethod post = new PostMethod(uri);
     Part[] parts;
                    parts = new Part[] {
                    new FilePart(file.getName(), file) // File you want to upload
     post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
     // Now perform the POST and check for errors
     HttpClient http = new HttpClient();
               int status = http.executeMethod(post);

Maybe there is a setting to enter somewhere?


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