gpt4 book ai didi

java.net.ConnectException : Tried all: '1' addresses, 但无法通过 HTTP 连接到服务器

转载 作者:太空宇宙 更新时间:2023-11-04 10:23:44 31 4
gpt4 key购买 nike

我在Weblogic服务器中运行程序时遇到以下问题。

网址http://localhost:8080 在我这边是可以访问的,但是当我使用下面的代码连接服务器时,它失败并出现连接异常。

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;

public static String invokeGet(String url, String dsl) {
String url = "http://localhost:8080";
Client clientInstance = Client.create();
clientInstance.addFilter(new HTTPBasicAuthFilter("", ""));

WebResource webResource = clientInstance.resource(url);

ClientResponse response =
webResource.entity(dsl).header("Content-type", "application/json").accept("application/json").get(ClientResponse.class);
}

详细错误信息:

Caused by: java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'hostname', port: '8080'

at weblogic.net.http.HttpClient.openServer(HttpClient.java:333)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:425)
at weblogic.net.http.HttpClient.New(HttpClient.java:252)
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:213)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:398)
at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:37)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1005)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:215)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
... 182 more

还有一点是,我在集成服务器中可以正常运行它,但在独立服务器中无法运行它。

最佳答案

似乎是在服务器上检查配置属性defaultzone。也许您会在这里找到解决方案:

评论:LINK

After days, looking thousand times on the same config file I realized the issue. At the end it was just a misspelling of defaultzone. After changing it to defaultZone everything works like expected. Thank you very much for your time.

关于java.net.ConnectException : Tried all: '1' addresses, 但无法通过 HTTP 连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50793771/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com