0

I am trying to release a project in jenkins and getting a host not found exception.

Caused by: java.lang.RuntimeException: java.net.UnknownHostException: XXXXXXXXXXXXXXX: nodename nor servname provided, or not known
    at org.apache.maven.scm.provider.perforce.PerforceScmProvider.generateDefaultClientspecName(PerforceScmProvider.java:420)
    at org.apache.maven.scm.provider.perforce.PerforceScmProvider.getClientspecName(PerforceScmProvider.java:395)
    at org.apache.maven.scm.provider.perforce.command.checkout.PerforceCheckOutCommand.executeCheckOutCommand(PerforceCheckOutCommand.java:75)
    at org.apache.maven.scm.command.checkout.AbstractCheckOutCommand.executeCommand(AbstractCheckOutCommand.java:82)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)

Reading through the source it looks like the exception is thrown on this line:

InetAddress.getLocalHost().getHostName();

Since I don't control the source for the release plugin other than changeing the code is there some way to work around this issue? Can I setup my etc hosts in some way to force specific response from "InetAddress.getLocalHost().getHostName()"?

1 Answer 1

2

I'm assuming that your XXXXXXXXXXXXXXX is masking an actual, non-localhost (or localhost variant/alias) hostname.

This can happen if your machine has a hostname/IP-address that cannot be both forward and reverse looked-up according to your local name resolver setup. InetAddress.getLocalHost() is known to perform reverse lookups to resolve the local host.

Run the hostname command, and make sure that you have an entry matching your real IP address to that name in /etc/hosts. It may be that hostname is returning either the FQDN hostname or the alias/short hostname, and that these cannot be forward/reverse looked-up.

Another problem can be IPv6 versus IPv4.

Note that the Jenkins JVM will cache hostname lookups, so it pays to have a small test program to make the test call to InetAddress.getLocalHost(), otherwise you should restart Jenkins after each configuration change you test.

Please provide feedback/additional details so I can improve this answer.

1
  • 1
    It was actually that the hostname command was returning a hostname which was not the DNS hostname. I fixed it by setting hostname to match DNS. May 23, 2013 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .