9 Replies Latest reply on May 13, 2013 1:25 PM by Stian Lund

    RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource

    Stian Lund Expert

      Hi,

      not sure if 4.7 is "official" yet but I noticed it was on Sourceforge so figured I'd test it

       

      Anyway, after install a new JBoss server was started, and 4.7 fails in the discovery with the following error:

       

       

      2013-05-08 16:15:00,960 ERROR [ResourceDiscoveryComponent.invoker.daemon-1] (rhq.modules.plugins.jbossas7.StandaloneASDiscovery)- Discovery of a JBossAS7 Standalone Server Resource failed for process: pid=[15918], name=[/opt/jboss/java/bin/java], ppid=[15867].
       java.lang.RuntimeException: Failed to determine product type for JBoss product installed at [/opt/jboss].
             at org.rhq.modules.plugins.jbossas7.JBossProductType.determineJBossProductTypeViaHomeDirName(JBossProductType.java:138)
              at org.rhq.modules.plugins.jbossas7.JBossProductType.determineJBossProductType(JBossProductType.java:67)
              at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.buildResourceDetails(BaseProcessDiscovery.java:196)
              at org.rhq.modules.plugins.jbossas7.StandaloneASDiscovery.buildResourceDetails(StandaloneASDiscovery.java:85)
              at org.rhq.modules.plugins.jbossas7.BaseProcessDiscovery.discoverResources(BaseProcessDiscovery.java:139)
              at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:294)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
              at java.util.concurrent.FutureTask.run(FutureTask.java:138)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)
       
      

       

       

      For all the other servers on the system the same error is output, but these have actually been Imported earlier.

       

      Is this a known bug, was I too quick in trying out 4.7 ?

       

      This is quite a big thing, if autodiscovery fails for all new JBoss AS7.

       

      EDIT: Could it be related to RHQ 4.7 running under JBoss EAP 6.1 Alpha? It seems the most logical explanation so far.

        • 1. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
          Heiko Rupp Master

          Hey,

           

          we have in 4.7 added code to detext WildFly servers.

          Now both as7.1 and WildFly share the absence of a product.conf file, so we try to fall back to determine the server version via server home directory name.

          If it contains -as then it is an JBossAS 7.1. If it contains wildfly it is a WildFly server. There are a few more products we check for, but if all of that

          fails we bail out.

          The previous plugin version was just falling back to AS, but this is no longer true.

           

          The information would be available via the API, but unfortunately unless the user has provided some default credentials, we don't have access to the api at this

          stage of discovery.

           

          But this is clearly an area to improve.

           

          Does the changed server home dir case apply to you?

           

          Heiko

          • 2. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
            Stian Lund Expert

            Thanks for the reply Heiko.

             

            So, how did this work in 4.6 and previous? And why was it changed?

            Because I had no problems detecting AS 7.1.1 in  RHQ 4.6. And it managed to detect version number fine after management was set up properly.

             

            Basically what you're saying is 4.7 won't detect AS 7.1 unless the directory name contains '-as' ? We have a lot of servers, all installed under /opt/jboss which was working fine until now...

            If this is true, we have to change location of all our over hundred Jboss installations, or wait to update RHQ from 4.6 until we migrate to Wildfly. This is not very good news

             

            Hope this is nothing permanent.

             

            -Stian

            • 3. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
              Heiko Rupp Master

              Stian,

               

              so what is the home directory name of your servers?

               

              For me it is /devel/jboss-as-7.1.1.Final and this works with the "as" in it.

               

              As I said previously there was no need to determine if a server is AS or WildFly, as there was no WildFly. Now there is.

               

              Previously if the product.conf checks failed we could just assume it is an AS. This is no longer true.

               

              I am offline tomorrow but can try to check if there is another way to distinguish between AS and WildFly than looking at home dirs on friday.

               

              If there is one, we can patch the code and I can just send you a "hand crafted" plugin to use with RHQ 4.7

              • 4. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                Stian Lund Expert

                Ok fair enough, I understand you needed to change it to discover Wildfly - but it's really bad for us here, since there are a lot of fixes in 4.7 that we're waiting to use in Production.

                 

                We install AS7 under /opt/jboss like the error message states.

                 

                Can't you either:

                1. Fall back to the old behaviour of assuming  'AS' if it does not find Wildfly (or -as in name)?

                2. Do checking of env.variables of the process found, like what is done in detection anyway - if they have variables containing JBOSS then it's AS. For instance JBOSS_HOME or JBOSS_BASE_DIR is always set.

                3. Check command line of process, if for instance "org.jboss.as.standalone" or "[Standalone]" or "jboss.home.dir" to assume it's AS. I assume it's something like this was done in the old way?

                 

                I would be happy to test if possible and will be back at work next week as well

                 

                 

                thanks,

                Stian

                • 5. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                  Stian Lund Expert

                  Heiko -

                  here is another suggestion, and in my opinion the best

                   

                  - If product.conf is not found, fall back to the last part of the path in JBOSS_BASE_DIR or jboss.server.base.dir, to name the discovered server.

                   

                  I guess you already have a look at the environment of the process to determine things so why not use this value?

                   

                  For a default install the name would be 'standalone', but for instance if you run several instances (like we do) you would have:

                  /opt/jboss/server/AppServer1 => AppServer1

                   

                  Today we have to rename our servers to give them logical names, but  with this solution it would not be necessary as a server would be called for instance "FinanceApp (0.0.0.0:9990)"

                  I think most people would be most happy with this, instead of ending up with the generic 'EAP' or 'Wildfly' servers they then have to rename anyway. I assume they already know they are running EAP or Wildfly right?

                  • 6. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                    Lukas Krejci Apprentice

                    There are other ways people are starting up AS servers. Similarly to how Tomcat works or how general Linux servers work, you can have 1 base installation with the "code"/common stuff of the server and launch it many times with different configurations. There are many ways to do it (jboss.server.base.dir and jboss.server.config.dir system props, custom startup scripts, etc.), but in the end what matters are the interface and port bindings of the individual servers. That's why we don't attempt to do any name guessing and just use the IP:PORT of the management interface of AS and the "type" of the AS (i.e. JBoss AS, EAP, Wildfly, JDG, etc.).

                     

                    Your suggestion would make sense in the default layout of AS7, where config is a subdir of the base. But that's overridable. What should be the name of the server if the config dir was outside of base? Feel free to raise a feature request at our BZ (https://bugzilla.redhat.com/enter_bug.cgi?product=RHQ%20Project) and we can try to cover as many scenarios as possible and provide a more intelligent default naming strategy of the servers.

                    • 7. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                      Heiko Rupp Master

                      Stian,

                       

                      > back to the last part of the path in JBOSS_BASE_DIR or jboss.server.base.dir, to name the discovered server

                       

                      This is most likely to fail too, as a WF user may just out of tradition move them to /opt/jboss, as some other software assumes that path.

                       

                      I have opened this Bugzilla entry: https://bugzilla.redhat.com/show_bug.cgi?id=961787

                       

                      What we do now is to first check product.conf. If this is not present, it is AS or WildFly.

                      In the latter case we look at the namespace of the <server> element in standalone.xml or the <host> element in host.xml

                       

                      If the namespace version number starts with 1 it is an AS. If not a WildFly.

                       

                      Are you able to compile the plugin from sources? Or shall I put a compiled version somewhere for you to try and give feedback?

                       

                         Heiko

                       

                      Btw.: With that amount of jboss servers, it could make sense to move to supported versions of AS and JBoss ON

                      • 8. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                        Stian Lund Expert

                        This is most likely to fail too, as a WF user may just out of tradition move them to /opt/jboss, as some other software assumes that path.

                         

                        Yeah, I guess using /opt/jboss is quite common. Here we use /opt/jboss/server/servername for different instances,  so it's similar to the way it was done in AS6, and I think it's pretty logical.

                         

                        However, would not the JBOSS_BASE_DIR always be a "logical" name? I understand some might move their config.dir to somewhere else, but deployments would still be under BASE_DIR, unless they specify that elsewhere as well.

                         

                        For a "default" install of AS7 the name would just be "standalone" or "domain". For those having moved it elsewhere it would be the name of the BASE_DIR. For those that do not "care" or run just one instance, it's just a name that does not matter, like "AS" or "EAP" or "Wildfly" is. But if I have a Jobsearch application I want to call the server "Jobsearch" not AS or Wildfly.

                         

                        I think it would work but it's merely a suggestion

                         

                        And with the amount of  different ways to install Jboss, that was a bit of my point, that RHQ should not try make assumptions on where people install the software or what the directory is named - because it is very flexible.

                         

                        Heiko Rupp wrote:

                        Are you able to compile the plugin from sources? Or shall I put a compiled version somewhere for you to try and give feedback?

                         

                        I'm hoping to in the future be able to do advanced things like compile and do changes to code, but for now it would be great to have a binary to download

                         

                        Heiko Rupp wrote:

                        Btw.: With that amount of jboss servers, it could make sense to move to supported versions of AS and JBoss ON

                         

                        Let's just say, it's in the works But we still have to run on AS7 for some time so it will be good to be able to still use and update RHQ for those installations.

                         

                        thanks,

                        Stian

                        • 9. Re: RHQ 4.7 - Error discovering JBoss AS 7.1.1 resource
                          Stian Lund Expert

                          The build 4.8 snapshot I got was able to find the AS7 servers and I have imported them. Thanks for the quick fix Heiko, much appreciated.

                           

                          I notice you did not use my suggestion to use BASE_DIR for the name - but maybe I can create a ER for it in Bugzilla

                           

                          cheers,

                          Stian