SocketException:无效参数:jre在映射驱动器上定位时创建

时间:2018-11-26 10:52:07

标签: java sockets launch4j mapped-drive

我有一个尝试连接到休息服务器的应用程序 在Java中使用HttpClient

这是连接代码:

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);

我希望用户不需要在本地PC上安装Java 所以我用launch4j的JRE 1.8目录编译了我的应用程序

,但是当此目录位于文件服务器驱动器的映射驱动器上时, 当它尝试连接到其余部分时出现此错误:

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

但是当JRE目录位于C语言驱动器等语言环境时,它可以正常工作。

但是我可以在映射的驱动器上解决此问题吗?

很多tnx

1 个答案:

答案 0 :(得分:0)

您尝试运行此代码的操作系统是什么?