killme2008 / xmemcached

High performance, easy to use multithreaded memcached client in java.
http://fnil.net/xmemcached
Apache License 2.0
757 stars 280 forks source link

UnknownHostException when initialising #128

Closed hamid646m closed 1 year ago

hamid646m commented 3 years ago

I'm getting exception for:

java.net.UnknownHostException: ip-X-X-X-X: ip-X-X-X-X: Name or service not known
    at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1642)
    at net.rubyeye.xmemcached.monitor.XMemcachedMbeanServer.initialize(XMemcachedMbeanServer.java:74)
    at net.rubyeye.xmemcached.monitor.XMemcachedMbeanServer.<init>(XMemcachedMbeanServer.java:64)
    at net.rubyeye.xmemcached.monitor.XMemcachedMbeanServer.<clinit>(XMemcachedMbeanServer.java:57)
    at net.rubyeye.xmemcached.impl.Optimizer.<init>(Optimizer.java:68)
    at net.rubyeye.xmemcached.impl.MemcachedConnector.<init>(MemcachedConnector.java:587)

even do xmemcached.jmx.enable is not enabled . I think we should move checking for the flag before any processing. I mean this line: https://github.com/killme2008/xmemcached/blob/master/src/main/java/net/rubyeye/xmemcached/monitor/XMemcachedMbeanServer.java#L84

if you agree I can create a PR

killme2008 commented 3 years ago

welcome to create a PR.

hamid646m commented 3 years ago

@killme2008 please review https://github.com/killme2008/xmemcached/pull/133/files