[jboss-user] [Beginner's Corner] - System.getProperty("jboss.server.config.dir") returns null on linux
Betto McRose Gamarra
do-not-reply at jboss.com
Wed Mar 13 14:00:28 EDT 2013
Betto McRose Gamarra [https://community.jboss.org/people/IcarusDB] created the discussion
"System.getProperty("jboss.server.config.dir") returns null on linux"
To view the discussion, visit: https://community.jboss.org/message/802438#802438
--------------------------------------------------------------
Hi all
I'm facing this problem, I'm trying to get the server config url but I'm getting null values
is it a permission problem ?
my linux is crunchbang 10
| | String filepath = System.getProperty("jboss.server.config.dir") + |
| | File.separator + cfgFileName; |
| |
|
| | PTIProperties parameteres = new PTIProperties(); |
| | parameteres.load(new FileInputStream(filepath)); |
I check every possibility but no success at all
/**
*
*/
package py.com.icarusdb.loadconfig.test;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import py.com.icarusdb.util.GlobalParameters;
import py.com.icarusdb.util.PTIProperties;
import py.com.icarusdb.util.UriBuilder;
> /**
> * @author mcrose
> *
> */
> public class loadConfig
> {
>
> private static final String JBOSS_SERVER_BASE_DIR = "jboss.server.config.url";
> private static String CFG_FILE_NAME = "auth-rest.cfg.properties";
>
> /**
> * @param args
> */
> public static void main(String[] args)
> {
> String filepath = System.getenv(JBOSS_SERVER_BASE_DIR);
>
> if(filepath == null || filepath.isEmpty())
> {
> Map<String, String> envvarz = System.getenv();
>
> System.out.println("scanning System.getevn()...");
>
> Iterator<String> iterator = envvarz.keySet().iterator();
> while (iterator.hasNext())
> {
> String key = iterator.next();
> if(key.toLowerCase().contains("jboss")) {
> System.out.println("key: " + key + "->" + envvarz.get(key));
> }
> }
>
> if(envvarz.containsKey(JBOSS_SERVER_BASE_DIR)) {
> filepath = envvarz.get(JBOSS_SERVER_BASE_DIR);
> }
> }
>
> if(filepath == null || filepath.isEmpty()) {
> filepath = System.getProperty(JBOSS_SERVER_BASE_DIR);
> }
>
> if(filepath == null || filepath.isEmpty())
> {
> System.out.println("\nscanning System.getProperties()...");
>
> Properties sysprops = System.getProperties();
> Iterator<Object> iterator = sysprops.keySet().iterator();
> while (iterator.hasNext())
> {
> Object key = iterator.next();
> if(key.toString().toLowerCase().contains("jboss")) {
> System.out.println("key: " + key + "->" + sysprops.get(key));
> }
> }
>
> if(sysprops.containsKey(JBOSS_SERVER_BASE_DIR)) {
> filepath = (String) sysprops.get(JBOSS_SERVER_BASE_DIR);
> }
>
> }
>
> if(filepath != null && !filepath.isEmpty())
> {
> System.out.println("filepath: " + filepath);
>
> filepath += CFG_FILE_NAME + GlobalParameters.SERVER_CONFIG_FILE_FOLDER;
>
> System.out.println("full-filepath: " + filepath);
>
> PTIProperties parameteres = new PTIProperties();
> try
> {
> parameteres.load(new FileInputStream(filepath));
> }
> catch (FileNotFoundException e)
> {
> e.printStackTrace();
> }
> catch (IOException e)
> {
> e.printStackTrace();
> }
>
>
> String uri = UriBuilder.buildLoginUri(parameteres);
> System.out.println("uri: " + uri);
> }
>
>
>
> }
>
>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/802438#802438]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130313/2829e4e1/attachment-0001.html
More information about the jboss-user
mailing list