2

I have written a java file which opens a HTTPS connection to a server that has given restricted access to call its web services from our unix server. So we are able to ping the server ip, telnet the server ip with port 443 all successfully so the network team has given confirmation that the we can start calling the webservices. Now we have tried everything on Windows server, installed the certificates they have provided in the local folder and simply run the jar. and we were able to establish connection. Now we have to migrate to unix server. We have copied the certificates local to the jar. On running the jar we get the following exception.

    java.net.UnknownHostException: wugateway2pi.westernunion.net
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
    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:564)
    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:388)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
    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)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
    at  sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
         (AbstractDelegateHttpsURLConnection.java:158)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream
          (HttpURLConnection.java:1014)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream
        (HttpsURLConnectionImpl.java:230)
    at utils.HelloWorld.heartbeat(HelloWorld.java:129)
    at utils.HelloWorld.main(HelloWorld.java:492)
     TRANSFAST: Some Error occurs during parsing the sendtrnx response
        java.lang.IllegalArgumentException: InputStream cannot be null
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:120)
    at utils.HelloWorld.heartbeat(HelloWorld.java:160)
    at utils.HelloWorld.main(HelloWorld.java:492)
      java.lang.RuntimeException: Exception in XML Parsing for the Response:
    at utils.HelloWorld.heartbeat(HelloWorld.java:184)
    at utils.HelloWorld.main(HelloWorld.java:492)
      Calling heartbeat  noCall

No idea what is missing.

Regards, Rache

pal4life
  • 3,210
  • 5
  • 36
  • 57
Rache
  • 217
  • 1
  • 7
  • 20
  • 1
    The problem is a `UnknownHostException`, so it could be a DNS problem. What does a  `dig wugateway2pi.westernunion.net` gives you ? It could be a IPv4/v6 problem, too. What is configured on the machines ? Do you use `-Djava.net.preferIPv4Stack=true` switch ? – Grooveek Jul 31 '12 at 10:31

1 Answers1

1

The issue was solved by adding below entry in my host file. (In Linux and Unix file will be available under /etc/hosts)

<ip address>       wugateway2pi.westernunion.net

This worked.

sloth
  • 99,095
  • 21
  • 171
  • 219
Rache
  • 217
  • 1
  • 7
  • 20
  • 1
    It's not a solution, it's just workaround. The domain that you request could be member of a cluster and a load balancer would redirect you, in this case you would break it since you're requesting directly to the ip address. You should try InstallCert.java instead. – Maozturk Nov 07 '14 at 16:20