I have a javasript running on a JAVA FX Web View. I am making an ajax call to an end point.
var formData3 = new FormData();
var content = veryLargeJSONString;
formData3.append("userfile", content);
xhttp3.open("POST", "http://testurl", true);
xhttp3.setRequestHeader("cache-control", "no-cache");
xhttp3.send(formData);
When xhttp3.open("POST", "http://testurl", false);
everything works as expected, the response always returns even though it takes a long time due to the large size of the form data.
When the asynch
flag is set to true, the response never even gets sent because JFX gives the following exception.
PM com.sun.webkit.network.URLLoader doRun
WARNING: Unexpected error
java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3479)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3462)
at com.sun.webkit.network.URLLoader.sendRequest(URLLoader.java:373)
at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:162)
at com.sun.webkit.network.URLLoader.lambda$run$91(URLLoader.java:128)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.webkit.network.URLLoader.run(URLLoader.java:127)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
This of course only occurs when the formData
content is very large, the exact same call with different smaller content has no issue.
I thought maybe this had something to do with the way I was starting the JVM, and thus I tried increasing the starting heap size and also max heap size.
java -jar test.jar -Xms4096m -Xmx8192m
So first question is, what could be causing this java exception and why does it only occur when Asynch is set to true for the ajax call.
Second What happens if in my java -jar
start up params I try to allocate more start up heap than my system has available? So if I have 16 gigs of RAM and i'm using 13 gigs and then I start my java app and try to allocate for the starting heap 4 gigs, will it just ignore my start up parameter?