I created a Java application that sends an HTTP POST request to another server.
- The firewall in the server is off.
- The firewall in the PC is off.
The application works perfectly on the PC in the C drive.
The application works perfectly on the PC with a local mapping drive.
But, when I put my application in a network mapping drive, I get an error:
java.net.SocketException: Invalid argument: create in mapped drive
This is my code:
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost postRequest = new HttpPost(getUrl());
postRequest.setHeader(AUTHERIZTION, getAuthString());
HttpResponse response = httpClient.execute(postRequest);
This is the full error:
java.net.SocketException: Invalid argument: create
at java.net.Socket.createImpl(Unknown Source)
at java.net.Socket.getImpl(Unknown Source)
at java.net.Socket.setSoTimeout(Unknown Source)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:119)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at rest.RestClient.postGetQuery(RestClient.java:105)
at frame.ScanJFrame.initProperty(ScanJFrame.java:195)
at Main.runAction(Main.java:63)
at Main.main(Main.java:21)
I tried this:
setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
But, nothing changed.
What can I do?