4 Replies Latest reply on Oct 29, 2009 3:14 PM by mawenzel

    jmx-console depends on generic named ear-file

      I have a filter class (for the JMX-Console) in an ear-file (test_xxx.ear) which is dynamically named.
      Now I have the following line in the jboss-web.xml of the jmx-console:

      <depends>jboss.j2ee:service=EARDeployment,url='test_xxx.ear'</depends>
      


      The problem is: the ear-file has a dynamically-given name (like test_010.ear, test_020.ear,...)

      I tried an url with an wildcard and a directory, but the result is the same:
      I get a warning-message like: MBeans waiting for other MBeans...
      What can I do?


        • 1. Re: jmx-console depends on generic named ear-file

          Ok, what I try is:

           <depends>jboss.j2ee:service=EARDeployment,url='test*'</depends>
          


          And the error, starting the jboss, is:

          java.lang.Error: Invalid ObjectName: jboss.j2ee:service=EARDeployment,url='test*'; javax.management.MalformedObjectNameException: Invalid character '*' in value part of property
           at org.jboss.mx.util.ObjectNameFactory.create(ObjectNameFactory.java:52)
           at org.jboss.metadata.WebMetaData.importJBossWebXml(WebMetaData.java:1261)
           at org.jboss.metadata.WebMetaData.importXml(WebMetaData.java:851)
          ....
          


          What is the reason for this error? I am using JBoss AS 4.2.3GA.

          • 2. Re: jmx-console depends on generic named ear-file
            dimitris

            What you've put there is not a valid JMX 1.2 ObjectName pattern.

            But even if you make it a valid ObjectName pattern, it won't work as you would like it. AFAIK, it will only accept a simple ObjectName, i.e. it won't dynamically try to resolve the pattern and establish potentially multiple dependencies.

            • 3. Re: jmx-console depends on generic named ear-file
              jaikiran

               

              "mawenzel" wrote:

              The problem is: the ear-file has a dynamically-given name (like test_010.ear, test_020.ear,...)


              How dynamic is the name? I mean do you know the name of the ear when the server is starting? If yes, then you can do something like this:

              <depends>jboss.j2ee:service=EARDeployment,url='${myEarName}'</depends>


              Notice the use of ${myEarName}. You can then pass -DmyEarName as a system property while starting the server:

              ./run.sh -DmyEarName=test_010.ear


              The property in the xml will then be replaced by this value during xml parsing by the JBoss server. You could even add the -D part into the JAVA_OPTS section within the run.sh/run.bat script instead of typing from the command line.



              • 4. Re: jmx-console depends on generic named ear-file

                Thank you, jaikiran! This is the searched solution. It works.
                I have written a small function, placed in the run-script, which gives me the name of the dynamic-named ear-file and assigns this to a variable.
                Thanks.