SocketException: Invalid argument: create when jre locate on mapped drive

432 Views Asked by At

I have an application that tries to connect to a REST server with HttpClient in Java.

This is the connection code:

HttpClient httpClient = HttpClientBuilder.create().build();

// Create new getRequest with below mentioned URL
HttpGet getRequest = new HttpGet(getUrl());

if(getAuthString() != null)
{
    getRequest.setHeader(AUTHERIZTION, getAuthString());
}

// Execute your request and catch response
HttpResponse response = httpClient.execute(getRequest);

I want that the user will not need to install Java on the local PC, so I compiled my application with launch4j with the directory of JRE 1.8.

However, when this directory is located on a mapped drive of a fileserver drive, I got this error when it's trying to connect to the REST server:

INFO: Retrying request to {}->REST SERVER IP
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(MainClie
ntExec.java:380)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.
java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java

When the JRE directory is located on local, such as C drive, it's working perfectly.

What can I do to fix this issue on my mapped drive?

0

There are 0 best solutions below