8 Replies Latest reply on May 19, 2006 3:47 AM by Marion Michelbrink

    Retrieve "binding address" within the application

    Marion Michelbrink Newbie

      Sorry to post this again - my subject went to hell....


      Hi folks,

      can anyone tell me, if there is a way to retrieve the jboss binding address as set in my run script ?
      I need this value in my application to generate an url.

      thanks a lot

        • 1. Re: Retrieve
          Marion Michelbrink Newbie

          Ok, so JBoss displays all the system properties during startup.
          But how do I get those properties in Java ?

          • 2. Re: Retrieve
            Scott Stark Master


            • 4. Re: Retrieve
              Marion Michelbrink Newbie

              Sorry Scott,
              I know it seems like I am dumb, but I really tried a couple of things before I posted this topic.

              If there is a simple way to retrieve this information, please tell me so.

              • 5. Re: Retrieve
                Scott Stark Master

                If its null then the no bind address has been spcified via the -b option (or --host long option) has not been specified.

                • 6. Re: Retrieve
                  Marion Michelbrink Newbie

                  In the "Full System Properties Dump" which is displayed in a logfile after startup, jboss claims the bind address to be "localhost", which is what I expect.
                  Still, in my Java application all I get is NULL.
                  Could it be that the jboss properties are hidden from the JVM ?

                  • 7. Re: Retrieve
                    Peter Johnson Master

                    Marion, where are you running the Java code that attempts to get the jboss.bind.address system property? Is it running within, say, a web application deployed to JBoss? Or is it running as a client Java app?

                    Just for grins, here is a JSP that I use to display the system properties. Packaged in a war file and accessed via the browser, it lists all system properties in alpha order. According to it, the jboss.bind.address is "" if not specified on the command line. While this makes sense from a server socket perspective, it probably doesn't help you with generating URLs.

                    <%@ page language="java" %>
                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE html
                     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                    <title>System Properties</title>
                     { font-family: Comic Sans MS, sans-serif
                     ; font-size: 11pt
                     ; background-color: #EFDBCD
                     { font-family: Arial Rounded MT Bold, sans-serif
                     ; font-size: 18pt
                     ; color: #8A6C49
                     ; text-align: center
                     { font-family: Arial Rounded MT Bold, sans-serif
                     ; font-size: 14pt
                     ; color: white
                     ; background-color: #8A6C49
                     * The path separator character, typically a colon or semi-colon.
                     private String sep;
                     * Places each item in a colon (or semi-colon) separated list on its
                     * own line. This makes the output for things such as the classpath
                     * more legible.
                     private String replaceAll(String str) {
                     StringBuffer buf = new StringBuffer();
                     int loc = str.indexOf(sep);
                     while (loc > 0) {
                     buf.append(str.substring(0, loc+1));
                     str = str.substring(loc + 1);
                     loc = str.indexOf(sep);
                     return buf.toString();
                    <h1>System Properties</h1>
                    <table border='1' cellpadding='2'>
                     java.util.TreeMap prop = new java.util.TreeMap(System.getProperties());
                     sep = (String)prop.get("path.separator");
                     for (java.util.Iterator iter = prop.keySet().iterator() ; iter.hasNext() ;) {
                     String p = (String)iter.next();
                     String v = (String)prop.get(p);
                     <%= p %>
                     <%= replaceAll(v) %>

                    • 8. Re: Retrieve
                      Marion Michelbrink Newbie

                      Hi Peter,
                      this is good to know, even if it propably wont help me. As you guessed, I am trying to get the properties inside a client application and not via jsp techniques.

                      thanx anyway