-
1. Re: Retrieve
mschwarz May 18, 2006 9:17 AM (in response to mschwarz)Ok, so JBoss displays all the system properties during startup.
But how do I get those properties in Java ? -
2. Re: Retrieve
starksm64 May 18, 2006 9:19 AM (in response to mschwarz)System.getProperty("jboss.bind.address")
-
-
4. Re: Retrieve
mschwarz May 18, 2006 9:25 AM (in response to mschwarz)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
starksm64 May 18, 2006 9:36 AM (in response to mschwarz)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
mschwarz May 18, 2006 9:59 AM (in response to mschwarz)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
peterj May 18, 2006 11:46 AM (in response to mschwarz)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 "0.0.0.0" 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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>System Properties</title> <style> body { font-family: Comic Sans MS, sans-serif ; font-size: 11pt ; background-color: #EFDBCD } h1 { font-family: Arial Rounded MT Bold, sans-serif ; font-size: 18pt ; color: #8A6C49 ; text-align: center } th { font-family: Arial Rounded MT Bold, sans-serif ; font-size: 14pt ; color: white ; background-color: #8A6C49 } </style> </head> <%! /* * 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)); buf.append("<br/>"); str = str.substring(loc + 1); loc = str.indexOf(sep); } buf.append(str); return buf.toString(); } %> <body> <h1>System Properties</h1> <table border='1' cellpadding='2'> <tr> <th>Property</th> <th>Value</th> </tr> <% 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); %> <tr> <td> <%= p %> </td> <td> <%= replaceAll(v) %> </td> </tr> <% } %> </table> </body> </html>
-
8. Re: Retrieve
mschwarz May 19, 2006 3:47 AM (in response to mschwarz)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