8 Replies Latest reply on Mar 15, 2011 11:30 AM by jesse.hazen

    jConsole

    zzpprk

      Hi

       

      Still a beginner with JBosss so please be patient with me.I wish to use jConsole to monitor a web service that is hosted by JBoss. I know that a JMX port needs to be open on the JVM to allow that but I am not sure what file I need to modify or how to modify it to tell JBoss to start the JVM with a JMX port open.

       

      I beleive the JVM arguments are

       

      -Dcom.sun.management.jmxremote.ssl=false

      -Dcom.sun.management.jmxremote.authenticate=false

      -Dcom.sun.management.jmxremote.port=8999

       

      Any help is greatly appreciated.

       

      Regards

       

      Patrick

        • 1. jConsole
          wdfink

          If you start with bin/run.sh (Unix) the bin/run.conf is the right place.

          But BTW you might start jconsole <PID> without having a remote connection

          • 2. Re: jConsole
            zzpprk

            Thanks. I know nothing about Unix so I am guessing here. Please confirm.

             

            Do I have to put the lines I mentioned above after the lines that say "-classpath "$JBOSS_CLASSPATH" \" in that file? Please find the run.sh file attached.

             

            Regards

             

            • 3. jConsole
              jesse.hazen

              No, put them in run.conf at the end of the line starting with "if [ "x$JAVA_OPTS" = "x" ]" (if you are using unix/linux). So, it may look like:

               

               

               

              if [ "x$JAVA_OPTS" = "x" ]; then

                 JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8999"

              fi

               

               

              Then you can connect up remotely to this machine from jconsole. Like Wolf-Dieter mentioned, though, if you are using jconsole on the same box, you don't need to add these lines. If you start jconsole it will list the java processes you can connect to locally.

              • 4. jConsole
                jesse.hazen

                You don't want to be editing the run.sh file, it is used to start JBoss. run.conf is the configuration, so if you need to edit the JBoss startup parameters, you want to edit run.conf normally. You shouldnt really need to edit run.sh as it will read run.conf and use the configuration you've set there when starting JBoss.

                • 5. jConsole
                  wdfink

                  If you want to add the parameter in every case you should use add line like:

                  JAVA_OPTS="$JAVA_OPTS -Dcom.sun........"

                  because otherwise the option is only added if you did not set JAVA_OPTS before starting the script.

                   

                  We change run.conf and set JAVA_OPTS in every case to avoid confusing behaviour depends to the environment

                  • 6. Re: jConsole
                    zzpprk

                    if [ "x$JAVA_OPTS" = "x" ]; then

                     

                    JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8999"

                    fi

                     

                    What is this if clause all about. Shouldn't I set thgese options outsdide the if?

                    • 7. jConsole
                      wdfink

                      The reason of the 'if' statement is that you might able to set different JAVA_OPTS before running run.sh.

                       

                      For our application we remove it because we want not to set it different by accident.

                      • 8. Re: jConsole
                        jesse.hazen

                        I just pasted some of the code from the run.conf for 5.1.0 out of the box. You can add those entries inside or outside the if clause.

                         

                        You could do it outside the if clause, like:

                         

                         

                         

                        if [ "x$JAVA_OPTS" = "x" ]; then

                           JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true"

                        fi

                        ## Specify the Security Manager options

                        #JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$POLICY"

                         

                        # Sample JPDA settings for remote socket debugging

                        #JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

                         

                        JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dsun.management.jmxremote.port=12345"

                         

                        # Sample JPDA settings for shared memory debugging

                        #JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,address=jboss,server=y,suspend=n"

                         

                         

                         

                         

                        The point is that this file is where the JAVA_OPTS variable is configured, so you will want to add the JVM arguments in this file.