We are using tomcat 7.0.27 in our application. We are below setting jmx properties on tomcat startup.
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8666 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
If the centOS server hostname on which this tomcat is running is set to all numeric value like 005056940096, tomcat does not start. It gives below exception.
Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: 005056940096: 005056940096 Server is running on centOS6. If hostname is set to non numeric value, it works properly.
I tried setting hostname in /etc/hosts and /etc/sysconfig/network, it still does not work. I also tried setting below property to server ip address, still it does not work. -Djava.rmi.server.hostname=${IP}
Please let me know if you have come across any such issue. Thanks.
I had also the same problem, but I found out:
The reason is that tomcat tries to bind to an IP so it does not use localhost, but your hostname.
In my case: SUSEDesktop.
So I had to add a hosts entry to /etc/hosts:
127.0.0.1 SUSEDesktop
::1 SUSEDesktop
Replace SUSEDesktop with the host name of your computer, you can find it out with:
uname -n
echo "127.0.0.1 $HOSTNAME" | sudo tee -a /etc/hosts
I had the same problem, finally solved by adding "Local" or "local" to /etc/hosts
Something like 127.0.0.1 localhost Local local
I had a similar problem starting a Spring-Boot app from the Spring Tools Suite on a Mac. It was a download from a Spring MVC / Spring Boot example for SOLR off Github.
The error was something like: java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException:XXXXXXX-221227.this.that.foo.other
By adding these two lines to the /private/etc/hosts
file on my Mac the problem went away. No "re-up" of the network interfaces was necessary.
127.0.0.1 XXXXXXX-221227.this.that.foo.other
::1 XXXXXXX-221227.this.that.foo.other
I assume this was related to the above issue with tomcat and a numeric name... as my computer name (supplied by the corporation) had numbers in it.
In any case, as soon as I could ping XXXXXXX-221227.this.that.foo.other
(obviously now the same as pinging localhost
or 127.0.0.1
) the spring boot app started (From the Spring Tools Suite UI) with no problem.
Oddly, the spring boot app started FINE from the command line with:
mvn spring-boot:run
-- I have no idea what the difference is/was.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With