• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.net.UnknownHostException on Solaris  RSS feed

 
Jitesh Sinha
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting following error on Solaris OS.

-a: -a

java.net.UnknownHostException: -a: -a
at java.net.InetAddress.getLocalHost(InetAddress.java:1315)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:178)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:475)
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:275)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:169)
at org.mortbay.jetty.servlet.Default.handleGet(Default.java:312)
at org.mortbay.jetty.servlet.Default.service(Default.java:232)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:475)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:556)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1563)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:623)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1515)
at org.mortbay.http.HttpServer.service(HttpServer.java:956)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


The line that it is pointing to is
String hostname = InetAddress.getLocalHost().getHostName();

I have checked /etc/hosts and /etc/nsswitch.conf files - they seem to be ok.

When I do getent hosts localhost - it returns correct IP address.

What can be the issue?Also why the exception has " -a: -a" - Does it mean that somehow it is trying to contact host by that name?

 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears that for some reason, Java resolves the localhost as "-a: -a".

Edit: I've gone through the code of InetAddress.getLocalHost, and it appears that the name is only resolved to "-a". Still no idea why.
 
Jitesh Sinha
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone please throw some light on it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!