Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having this strange error.

On AIX, I can reach my server from the command line ( using ping / telnet )

But If I try using java I've got UnkownHostException

This is because Java cannot somehow "use" the DNS but I don't know why. If I use the IP address it works fine.

This is my test program.


    public class Test {
            public static void main( String [] args ) throws Exception  {
                    String host = args[0];
                    int port = Integer.parseInt( args[1] );
                    System.out.println("Connecting to: " + host + " at port: " + port );
                    Socket socket = new Socket( host, port );


Is anyone aware of some kind of configuration under AIX that forbids programs ( like java ) to access DNS information?

I ( well the sysadm ) have added my address in /etc/hosts but it doesn't work either.

Thanks in advance

Java version:

Java(TM) 2 Runtime Environment, Standard Edition (build pap32dev-20080315 (SR7))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc-32 j9vmap3223-20080315 (JIT enabled)
share|improve this question
What do you have defined in /etc/irs.conf? – squillman Jun 9 '09 at 3:05

Is IPv6 support at fault? Try setting the system property

See what InetAddress.getAllByName(), InetAddress.getAllByAddress() return.

share|improve this answer

I don't know if Java uses DNS differently, but on AIX if you are going to use the /etc/hosts file, you should make sure /etc/netsvc.conf is set correctly. By default, if /etc/resolv.conf is found, AIX will use DNS, then hosts. To have hosts be first, make sure you have a line in /etc/netsvc.conf that says something like hosts=local,bind4

share|improve this answer

There are definitely some long term DNS issues with Java and AIX, it's been a while since I've looked at it but try using the fully-qualified domain name rather than a short one.

Also, Java on AIX doesn't seem to use the /etc/hosts file to do name resolutions if /etc/resolv.conf exists, god knows why.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.