title: UnknownHostException from Java but host resolves with Ping/nslookup/curl
body: <p>We are getting the following exception when a Java EE server tries to resolve a host name from one of the services. We were able to resolve that host name on the box manually with ping/nslookup command. We were also able to fire that external service using curl with same parameters what server is trying to use. So it seems like this issue happens only when we try to make a request to a external host from a Java/Java EE application.</p>
  
  <p>To resolve this issue, we manually added an entry in /etc/hosts file and it solved the problem but we want a permanent solution so we don't have to keep changing the IP. It was working before without adding that entry but all of a sudden it stopped working.</p>
  
  <p>Detail of our environment:</p>
  
  <p>OS: Cent OS 6.3</p>
  
  <p>Java : JDK 1.6.0_24</p>
  
  <p>Java EE Server : JBoss AS 7.1.1</p>
  
  <p>Http Client library : httpclient-4.0.jar</p>
  
  <p>Thanks in advance for the help!!</p>
  
  <blockquote>
    <p>Error while checking salesforce license|:
    java.net.UnknownHostException: na15.salesforce.com        at
    java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:175)
    [rt.jar:1.6.0_24]        at
    java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
    [rt.jar:1.6.0_24]        at java.net.Socket.connect(Socket.java:546)
    [rt.jar:1.6.0_24]        at
    sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:584)
    [jsse.jar:1.6.0_24]        at
    org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:333)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:101)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    [httpclient-4.0.jar:4.0]        at
    org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    [httpclient-4.0.jar:4.0]</p>
  </blockquote>