未知主机异常DNS错误

时间:2013-10-04 08:57:25

标签: java xml web host connectivity

我正在尝试连接服务

https://staging.identitymanagement.lexisnexis.com/identity-proofing/services/identityProofingServiceWS/v2

这是由Lexis Nexis托管的网络服务。

遇到以下异常。

  staging.identitymanagement.lexisnexis.com (java.net.UnknownHostException)
  java.net.PlainSocketImpl:177 (null)
  Initialisation Failure: staging.identitymanagement.lexisnexis.com
  java.net.UnknownHostException: staging.identitymanagement.lexisnexis.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.
      connect      (BaseSSLSocketImpl.java:141)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.
     getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)

我正在尝试使用mule集成服务来调用它。但是,我们仍然遇到此问题的未知主机异常。 我也正确地添加了相同的代理详细信息。

请指引我前进的方向。

1 个答案:

答案 0 :(得分:0)

对我来说似乎是一个网络代理问题。 http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

您是否已将代理添加到服务器启动脚本中的vm参数(JAVA_OPTIONS)中? 看起来应该是这样的。

JAVA_FLAGS=-Dhttp.proxyHost=hostname.example.com -Dhttp.proxyPort=8080
java ${JAVA_FLAGS} ...

我还建议以编程方式设置代理

public void setProxy() {
    if (isUseHTTPProxy()) {
        // HTTP/HTTPS Proxy
        System.setProperty("http.proxyHost", getHTTPHost());
        System.setProperty("http.proxyPort", getHTTPPort());
        System.setProperty("https.proxyHost", getHTTPHost());
        System.setProperty("https.proxyPort", getHTTPPort());
        if (isUseHTTPAuth()) {
            String encoded = new String(Base64.encodeBase64((getHTTPUsername() + ":" + getHTTPPassword()).getBytes()));
            con.setRequestProperty("Proxy-Authorization", "Basic " + encoded);
            Authenticator.setDefault(new ProxyAuth(getHTTPUsername(), getHTTPPassword()));
        }
    }