[wildfly-dev] WildFly Server IP Address and Port

Tristan Tarrant ttarrant at redhat.com
Tue Sep 1 15:40:16 EDT 2015


You are getting the address of the public http interface which might not necessarily correspond to the port you want to use for clustering. 

--
Tristan Tarrant 
Infinispan Lead 
JBoss a division of Red Hat 

From: Bob McWhirter
Sent: 1 Sep 2015 19:39
To: Filippe spolti
Cc: wildfly-dev at lists.jboss.org
Subject: Re: [wildfly-dev] WildFly Server IP Address and Port

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.


On Tue, Sep 1, 2015 at 2:25 PM, Filippe spolti <filippespolti at gmail.com>
wrote:

> Hello Arun,
>
> I usethis code w/ Jboss 7 and wildfly 8, i didn't test with wildfly 9/10.
>
>         MBeanServer mBeanServer =
> ManagementFactory.getPlatformMBeanServer();
>         String url = null;
>         try {
>
>             ObjectName http = new ObjectName("jboss.as:
> socket-binding-group=standard-sockets,socket-binding=http");
>             String jbossHttpAddress = (String)
> mBeanServer.getAttribute(http,"boundAddress");
>             int jbossHttpPort = (Integer)
> mBeanServer.getAttribute(http,"boundPort");
>             url = jbossHttpAddress + ":" + jbossHttpPort;
>             log.fine("Url obtained from the system: " + url);
>         } catch (Exception e) {
>             log.severe(e.getStackTrace().toString());
>         }
>         return url;
>
> regards.
>
>
> On 09/01/2015 02:20 PM, Arun Gupta wrote:
>
> 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
>
>
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20150901/ab8169f9/attachment.html 
-------------- next part --------------
_______________________________________________
wildfly-dev mailing list
wildfly-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/wildfly-dev


More information about the wildfly-dev mailing list