Java未知主机调用Marketo API时出现异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java未知主机调用Marketo API时出现异常相关的知识,希望对你有一定的参考价值。

我跟着他们在github上提供的marketo示例代码,我收到以下错误

注意:我在使用端口80的eclipse中使用代理设置


java.net.UnknownHostException: **my instance URL**
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
    at Leads.getToken(Leads.java:97)
    at Leads.getData(Leads.java:40)
    at Leads.main(Leads.java:30)
答案

您的IP地址无效,您正在进行API调用,您可以简单地将该IP与端口号一起telnet,以验证您是否可以访问该IP地址。

以上是关于Java未知主机调用Marketo API时出现异常的主要内容,如果未能解决你的问题,请参考以下文章

调用共享 WebMethod 时出现未知 Web 方法异常

通过 Graph API 和 iOS 将照片上传到相册时出现 Facebook 错误:(#1) 发生未知错误

从 Angular Js(Java Web)调用 API 时出现 CORS 错误

无法连接到 ejabberd 服务器:未知主机异常

在 Kubernetes Ingress 从 v1beta1 切换到 v1 时出现错误“io.k8s.api.networking.v1.IngressBackend”中的“未知字段“serviceN

Angular 调用 Eureka API 时出现 CORS 来源错误