11 Replies Latest reply on Mar 18, 2013 8:36 AM by icarusdb

    jboss.server.config.dir not found in crunchbang linux (debian)

    icarusdb

      System.getenv(JBOSS_SERVER_BASE_DIR);

       

      System.getProperty(JBOSS_SERVER_BASE_DIR);

       

      both return null

       

       

      iterating getevn() map and checking for variables containing "jboss" I only get JBOSS_HOME

       

      iterating getProperties() map also checking the same... I get nothing !

       

      I started the server both in eclipse and cli, getting the same result: null

        • 1. Re: jboss.server.config.dir not found in crunchbang linux (debian)
          jamezp

          I created this servlet and it works for me on Fedora 18.

          import java.io.IOException;
          import java.io.PrintWriter;
          import java.util.Properties;
          import javax.servlet.ServletException;
          import javax.servlet.annotation.WebServlet;
          import javax.servlet.http.HttpServlet;
          import javax.servlet.http.HttpServletRequest;
          import javax.servlet.http.HttpServletResponse;
          
           @WebServlet("/list-props")
          public class ListPropertiesServlet extends HttpServlet {
          
          
              static String PAGE_HEADER = "<html><head><title>Properties</title><body>";
          
          
              static String PAGE_FOOTER = "</body></html>";
          
          
              @Override
              protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                  resp.setContentType("text/html");
                  final String key = req.getParameter("key");
                  final PrintWriter writer = resp.getWriter();
                  final Properties props = System.getProperties();
                  writer.println(PAGE_HEADER);
                  writer.println("<ul>");
                  for (String name : props.stringPropertyNames()) {
                      boolean doWrite = key == null || name.contains(key);
                      if (doWrite) {
                          writer.println("<li>");
                          writer.print(name);
                          writer.print('=');
                          writer.print(props.getProperty(name, "null"));
                          writer.println();
                          writer.println("</li>");
                      }
                  }
                  writer.println("</ul>");
                  writer.println(PAGE_FOOTER);
                  writer.close();
              }
          }
          
          

           

          --

          James R. Perkins

          • 2. Re: jboss.server.config.dir not found in crunchbang linux (debian)
            icarusdb

            good for you

             

            :S

            • 3. Re: jboss.server.config.dir not found in crunchbang linux (debian)
              nickarls

              But it's visible in boot.log/server.log, right?

              • 4. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                icarusdb

                yep

                 

                also from web console

                 

                boot.log

                ======

                07:43:24,716 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

                07:43:25,673 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

                07:43:25,729 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

                07:43:25,731 DEBUG [org.jboss.as.config] Configured system properties:

                    file.encoding = UTF-8

                    file.encoding.pkg = sun.io

                    file.separator = /

                    java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment

                    java.awt.headless = true

                    java.awt.printerjob = sun.print.PSPrinterJob

                    java.class.path = /home/rgamarra/servers/jboss-as-7.1.1.Final/jboss-modules.jar

                    java.class.version = 50.0

                    java.endorsed.dirs = /usr/lib/jvm/java-6-openjdk/jre/lib/endorsed

                    java.ext.dirs = /usr/lib/jvm/java-6-openjdk/jre/lib/ext:/usr/java/packages/lib/ext

                    java.home = /usr/lib/jvm/java-6-openjdk/jre

                    java.io.tmpdir = /tmp

                    java.library.path = /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib

                    java.net.preferIPv4Stack = true

                    java.runtime.name = OpenJDK Runtime Environment

                    java.runtime.version = 1.6.0_18-b18

                    java.specification.name = Java Platform API Specification

                    java.specification.vendor = Sun Microsystems Inc.

                    java.specification.version = 1.6

                    java.util.logging.manager = org.jboss.logmanager.LogManager

                    java.vendor = Sun Microsystems Inc.

                    java.vendor.url = http://java.sun.com/

                    java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi

                    java.version = 1.6.0_18

                    java.vm.info = mixed mode

                    java.vm.name = OpenJDK 64-Bit Server VM

                    java.vm.specification.name = Java Virtual Machine Specification

                    java.vm.specification.vendor = Sun Microsystems Inc.

                    java.vm.specification.version = 1.0

                    java.vm.vendor = Sun Microsystems Inc.

                    java.vm.version = 14.0-b16

                    javax.management.builder.initial = org.jboss.as.jmx.PluggableMBeanServerBuilder

                    javax.xml.datatype.DatatypeFactory = __redirected.__DatatypeFactory

                    javax.xml.parsers.DocumentBuilderFactory = __redirected.__DocumentBuilderFactory

                    javax.xml.parsers.SAXParserFactory = __redirected.__SAXParserFactory

                    javax.xml.stream.XMLEventFactory = __redirected.__XMLEventFactory

                    javax.xml.stream.XMLInputFactory = __redirected.__XMLInputFactory

                    javax.xml.stream.XMLOutputFactory = __redirected.__XMLOutputFactory

                    javax.xml.transform.TransformerFactory = __redirected.__TransformerFactory

                    javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema = __redirected.__SchemaFactory

                    javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom = __redirected.__XPathFactory

                    jboss.bind.address = localhost

                    jboss.home.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final

                    jboss.host.name = fabrica-arquitectura

                    jboss.modules.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/modules

                    jboss.modules.system.pkgs = org.jboss.byteman

                    jboss.node.name = fabrica-arquitectura

                    jboss.qualified.host.name = fabrica-arquitectura

                    jboss.server.base.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone

                    jboss.server.config.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/configuration

                    jboss.server.data.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/data

                    jboss.server.deploy.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/data/content

                    jboss.server.log.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/log

                    jboss.server.name = fabrica-arquitectura

                    jboss.server.temp.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/tmp

                    line.separator =

                 

                    logging.configuration = file:/home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/configuration/logging.properties

                    module.path = /home/rgamarra/servers/jboss-as-7.1.1.Final/modules

                    org.jboss.boot.log.file = /home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/log/boot.log

                    org.jboss.resolver.warning = true

                    org.xml.sax.driver = __redirected.__XMLReaderFactory

                    os.arch = amd64

                    os.name = Linux

                    os.version = 2.6.32-5-amd64

                    path.separator = :

                    sun.arch.data.model = 64

                    sun.boot.class.path = /usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk/jre/classes

                    sun.boot.library.path = /usr/lib/jvm/java-6-openjdk/jre/lib/amd64

                    sun.cpu.endian = little

                    sun.cpu.isalist =

                    sun.io.unicode.encoding = UnicodeLittle

                    sun.java.launcher = SUN_STANDARD

                    sun.jnu.encoding = UTF-8

                    sun.management.compiler = HotSpot 64-Bit Server Compiler

                    sun.os.patch.level = unknown

                    sun.rmi.dgc.client.gcInterval = 3600000

                    sun.rmi.dgc.server.gcInterval = 3600000

                    user.country = PY

                    user.dir = /home/rgamarra/servers/jboss-as-7.1.1.Final/bin

                    user.home = /home/rgamarra

                    user.language = es

                    user.name = rgamarra

                    user.timezone = America/Asuncion

                07:43:25,752 DEBUG [org.jboss.as.config] VM Arguments: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:39918 -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/log/boot.log -Dlogging.configuration=file:/home/rgamarra/servers/jboss-as-7.1.1.Final/standalone/configuration/logging.properties -Djboss.home.dir=/home/rgamarra/servers/jboss-as-7.1.1.Final -Dfile.encoding=UTF-8

                07:43:28,992 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

                07:43:29,019 INFO  [org.xnio] XNIO Version 3.0.3.GA

                07:43:29,031 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA

                07:43:29,040 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA

                07:43:29,125 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

                • 5. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                  nickarls

                  And the System.get* are executed in code deployed to the server?

                  • 6. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                    icarusdb

                    yep

                     

                    in the eclipe ide all "as one" or "in the same 'session' " (sorry for my bad english)

                     

                    also tried jboss running as standalone (cli) and runnging the project as a running jar in cli also

                     

                    this is the code:

                    ============

                     

                    /**

                    *

                    */

                    package py.org.pti.loadconfig.test;

                     

                    import java.util.Iterator;

                    import java.util.Map;

                    import java.util.Properties;

                     

                    /**

                    * @author mcrose

                    *

                    */

                    public class loadConfigv2

                    {

                     

                        private static final String JBOSS_SERVER_BASE_DIR = "jboss.server.config.dir";

                        private static final String KEY = "jboss";

                     

                        public static void main(String[] args)

                        {

                           

                           

                            String filepath = System.getenv(JBOSS_SERVER_BASE_DIR);

                           

                            boolean somethingfound = false;

                           

                            if(filepath == null || filepath.isEmpty())

                            {

                                Map<String, String> envvarz = System.getenv();

                               

                                System.out.println("\nscanning System.getenv()...");

                               

                                Iterator<String> iterator = envvarz.keySet().iterator();

                                while (iterator.hasNext())

                                {

                                    String key = iterator.next();

                                    if(key.toLowerCase().contains(KEY)) {

                                        somethingfound = true;

                                        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(!somethingfound) {

                                System.out.println("nothing found ");

                            } else {

                                somethingfound = false;

                            }

                           

                            if(filepath == null || filepath.isEmpty())

                            {

                                System.out.println("\nscanning System.getProperties()...");

                               

                                Properties sysprops = System.getProperties();

                                for(String key : sysprops.stringPropertyNames())

                                {

                                    if(key.toLowerCase().contains(KEY)) {

                                        somethingfound = true;

                                        System.out.println("key: " + key + "->" + sysprops.get(key));

                                    }

                                }

                     

                                if(sysprops.containsKey(JBOSS_SERVER_BASE_DIR)) {

                                    filepath = (String) sysprops.get(JBOSS_SERVER_BASE_DIR);

                                }

                               

                            }

                           

                            if (!somethingfound)

                            {

                                System.out.println("nothing found ");

                            }

                     

                        }

                     

                    }

                    • 7. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                      nickarls

                      yep

                       

                      in the eclipe ide all "as one" or "in the same 'session' " (sorry for my bad english)

                       

                      also tried jboss running as standalone (cli) and runnging the project as a running jar in cli also

                       

                       

                       

                      I'm not sure I follow but I get the feeling that you are looking at a different env. James' servlet is run in the AS and sets the env the bootstrapping says but If you run it externally (even if you think you are running it in-server), you will se no jboss-specific env.

                      1 of 1 people found this helpful
                      • 8. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                        jaikiran

                        also tried jboss running as standalone (cli) and runnging the project as a running jar in cli also

                        ...

                        public class loadConfigv2

                        {

                         

                         

                         

                            public static void main(String[] args)

                        So you are triggering a standalone client and checking the properties from within that? That won't work. Have you tried it from a servlet or some other server side component which runs within the server's JVM? That's what James was trying to help you with when he posted that code.

                        1 of 1 people found this helpful
                        • 9. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                          nickarls

                          Two opinions so close it *must* be true

                          • 10. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                            icarusdb

                            ok

                             

                            I'll try to run a that webservlet

                            • 11. Re: jboss.server.config.dir not found in crunchbang linux (debian)
                              icarusdb

                              just tell me how I forgot this basic thing