4 Replies Latest reply on Jan 29, 2003 2:37 AM by minamoto

    Gettign JBoss Version

    alepape

      As I have several jboss systems to work with (2.2, 2.4 and 3.0), I'd like to be able to get which version my code is running on. I've read somewhere that the jboss version string could be found in System.properties, but it doesn't seem so. Does anyone know how to get the version string ?

        • 1. Re: Gettign JBoss Version
          falk

          During startup of the server, in the main-file:

          public Main(String confName, String patchDir)
          {
          Package mainPkg = Package.getPackage("org.jboss");
          System.out.println("JBoss release: "+mainPkg.getImplementationTitle());
          System.out.println("JBoss version: "+mainPkg.getImplementationVersion());
          ...


          Maybe this would help you!
          Falk

          • 2. Re: Gettign JBoss Version
            alepape

            thanks, it DOES help me !!

            • 3. Re: Gettign JBoss Version
              nick.mills

              from at least as early as 3.0.4 you can just do
              java -jar run.jar --version
              ...from the jboss bin directory and it spits out the version for you :-)

              • 4. Re: Gettign JBoss Version
                minamoto

                Hi,

                My ROOT.war has next index.jsp, which doesn't work for 2.x though.

                <%@page import="javax.management.*"%>


                Welcome to JBoss


                <%!
                private MBeanServer getMBeanServer() {
                java.util.List list = MBeanServerFactory.findMBeanServer(null);
                return (MBeanServer) list.iterator().next();
                }

                private String getJBossVersion() throws Exception {
                ObjectName mbean = new ObjectName("jboss.system:type=Server");
                return (String) getMBeanServer().getAttribute(mbean, "VersionName");
                }
                %>

                Your JBoss version is <%=getJBossVersion()%>

                JMX console




                Miki