<html><body><div><div style="font-family:Calibri, Arial, Helvetica, sans-serif; font-size:12.0pt; color:#1F497D"><div>You are getting the address of the public http interface which might not necessarily correspond to the port you want to use for clustering. </div>
<div><br></div>
<div id="signature-x" style="-webkit-user-select:none; font-family:Calibri, Arial, Helvetica, sans-serif; font-size:12.0pt; color:#1F497D"><div>--</div><div>Tristan Tarrant </div><div>Infinispan Lead </div><div>JBoss a division of Red Hat </div>
</div></div><div id="quoted_header" style="clear:both;"><br/><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><span style="font-size:11.0pt;font-family:'Calibri','sans-serif'"><b>From:</b> Bob McWhirter<br><b>Sent:</b> 1 Sep 2015 19:39<br><b>To:</b> Filippe spolti<br><b>Cc:</b> wildfly-dev@lists.jboss.org<br><b>Subject:</b> Re: [wildfly-dev] WildFly Server IP Address and Port<br></span></div></div><br type='attribution'></div><br><div><div dir="ltr">Is this something JGroups/Clustering could use? I've found that using 0.0.0.0 makes JGroups complain, because it has no idea which interface to actually use for multicast.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 1, 2015 at 2:25 PM, Filippe spolti <span dir="ltr"><<a href="mailto:filippespolti@gmail.com" target="_blank">filippespolti@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hello Arun,<br>
<br>
I usethis code w/ Jboss 7 and wildfly 8, i didn't test with wildfly
9/10.<br>
<br>
MBeanServer mBeanServer =
ManagementFactory.getPlatformMBeanServer();<br>
String url = null;<br>
try {<br>
<br>
ObjectName http = new
ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http");<br>
String jbossHttpAddress = (String)
mBeanServer.getAttribute(http,"boundAddress");<br>
int jbossHttpPort = (Integer)
mBeanServer.getAttribute(http,"boundPort");<br>
url = jbossHttpAddress + ":" + jbossHttpPort;<br>
log.fine("Url obtained from the system: " + url);<br>
} catch (Exception e) {<br>
log.severe(e.getStackTrace().toString());<br>
}<br>
return url;<br>
<br>
regards.<span class=""><br>
<br>
<br>
<div>On 09/01/2015 02:20 PM, Arun Gupta
wrote:<br>
</div>
<blockquote type="cite">
<pre>Assuming WildFly is bound to all available IP addresses using -b
0.0.0.0, is there a WildFly-specific API that can be used to obtain
the IP address where the server is running?
Ideally, I'd like something like:
WildFly.getHostAddress()
WildFly.getHostPort()
It could be running in a Docker container, in AWS, on my local laptop,
in OpenShift, or any where else and would like the IP address to be
returned correctly.
Suggestions?
Arun
</pre>
</blockquote>
<br>
</span></div>
<br>_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br></blockquote></div><br></div>
</div></body></html>