0

Our lab uses several ruggedized military laptops in a closed-network business environment. These computers are running identical Windows 7 versions, networked with static IP's, running Apache Tomcat and Java.

An unusual combination of factors causes the InetAddress.getLocalHost().getHostName() Java method to fail consistently, resulting in HTTP 500 errors in Tomcat:

Could not call log service due to:
java.net.UnknownHostException: examplePc1: examplePc1 at
java.net.InetAddress.getLocalHost(Unknown Source)
at ...myservices.wrappers.logservice.LogServiceWrapper.log(Unknown Source)
at org.apache.jsp.checkConnection_jsp._jspService(checkConnection_jsp.java:150)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
etc...

This issue only occurs if the device’s name or IP address is in the local hosts file and when the device is powered up it is not connected to the network.

  • Microsoft Windows 7 Professional
  • Version 6.1.7601, Service Pack 1, Build 7601
  • Java 7, (1.7.0_45)
  • Apache Tomcat 7.0

The issue is resolved when the device's IP address is commented-out or removed from the Hosts file.

We have several applications with code that (apparently) use the InetAddress.getLocalHost().getHostName() Java method, but not all of the code can be modified by us. Also tailoring the hosts file for each laptop is not preferred due to the number of devices at the enterprise level.

Has anyone else encountered this bug? Is this an issue with Windows 7, Java, or both? Do you know if/where this bug is documented?

MAbraham1
  • 1,717
  • 4
  • 28
  • 45

0 Answers0