Announcement Announcement Module
No announcement yet.
AMS not detecting exported beans Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AMS not detecting exported beans

    I'm trying to setup AMS to monitor our application. I've followed all the steps of the tutorials and AMS auto-discovers the application along with the Spring Application Context and the Spring Bean Factory.

    However, any beans that I've set with the @ManagedResource attribute/@ManagedMetric attribute doesn't show up on the list.

    Now when I connect via JConsole and goto the MBeans tab, I see that the ApplicationContext and BeanFactory show up under spring.application and all the classes that I've marked with @ManagedResource show up under the fully qualified package name.

    Any help to point me in the right direction would be greatly appreciated.


  • #2
    Does that mean that the @ManagedResources you are exporting do not have the domain "spring.application" in their ObjectNames? They must have that domain in order to be auto-discovered by AMS. In the future, we will be removing this restriction in favor of (most likely) a recognized key property value.



    • #3
      Hello Jen,
      Thanks for the reply. It would also be great if you could add this to the documentation.

      I have changed the domain name of the @ManagedResource as follows:

      @ManagedResource(objectName="spring.application:na me=MarketDataManager",description = "Market Data Manager")

      and I still am unable to get AMS to auto-discover the bean. In fact, the auto-discovery of the Spring Application seems flaky.



      • #4
        The "source-level metadata type" section of (this file is also available in the doc directory of your AMS server) covers the expected format of the ObjectName. Looks like you are missing the "type" key property.

        Also, what are you doing to trigger auto-discovery of your new MBeans? By default, AMS auto-discovers servers every 15 minutes, but new services within an existing server (such as ApplicationContext, BeanFactory, etc) are only auto-discovered once every 24 hours. You can change this interval in AMS_HOME/agent-2.0.0.RC1/ autoinventory.runtimeScan.interval.millis property. However, if you're still in the evaluation phase, the quickest way to trigger auto-discovery of services is to restart the agent.


        • #5
          After reading the docs and this thread, I've been attempting to use SpringSource AMS v2.0.0.rc1 to manage a managed resource bean exported, via jmx, from a bundle in SpringSource dm server v1.0.1.RELEASE. I'm not entirely certain of the service type I'm looking for, but I can't find anything even close to my service. The annotation I'm using for my exported bean is as follows:

          @ManagedResource(objectName = "spring.application:type=KeyGenerator,name=Armadil lo Key Generator",description="Generates keys")

          and it shows up in JConsole under:

          spring.application/KeyGenerator/Armadillo Key Generator

          I've tried restarting the agent. Is there anything else I need to do? Do I need to write a plugin?

          Thank you.


          • #6
            That should be enough to get your service discovered. I assume the agent has auto-discovered the dm Server, but your service just does not show up under the server's resource listing (it's a common misconception that new services will show up in the Auto-Discovery portlet - just want to make sure you are not expecting to see it there).

            Can you post your agent.log (from AMS_HOME/agent.../logs)? Also, how are you using the bundle in dm Server (part of a PAR, shared services WAR, etc)? Lastly, does your MBean have any @ManagedAttributes, @ManagedOperations, or @ManagedMetrics?


            • #7
              I was thinking the auto-discovery portlet might be for just for new platforms. I've been checking the Resources > Browse page to check the services.

              The bundle I'm using is solely for evaluating AMS, and is independently deployed via the Tool Suite. My KeyGenerator does have one of each @ManagedAttribute, @ManagedOperations, and @ManagedMetrics.

              The attached agent.log file is the logged output from the following: started agent; started dm server; stopped agent; started agent again to force discovery.

              Thank you very much.


              • #8
                Sorry, forgot to mention two things. I am seeing the dm server and a dispatcherServlet for my bundle as a service. Also, in my bundle's trace file, during initialization, I get the following a couple times:

                [2009-03-18 09:44:22.876] async-delivery-thread-1 W Unable to discover the domain associated with ApplicationContext: ServerOsgiBundleXmlWebApplicationContext(bundle=com.spintop.cart.gui.images.redirector, config=osgibundle:/META-INF/spring/*.xml).  The application context and all of its beans will not be exported to the management model.


                • #9
                  Seems like you've got 2 issues here:
                  1. Since you are using dm Server and not dm Server Enterprise Edition, the instrumented jars are only able to export MBeans for Spring beans created by WebApplicationContexts. dm Server EE publishes additional information that allows the instrumented jars to publish MBeans based on bundle lifecycle. This explains why you are missing some MBeans, and explains the message you are seeing in your bundle's trace file. You can download an evaluation copy of dm Server Enterprise Edition from However, it bundles AMS 1.0.6 by default (which does not allow you to export your own components to the mgmt model using the Spring JMX annotations). You will likely encounter issues attempting to use both versions of the instrumented jars (1.0.6 and 2.0.0RC1) in dm Server EE. We are currently working to provide support for bundles using AMS 2.x in dm Server. Of course, deploying a WAR that uses AMS 2.x in dm Server should work fine.
                  2. The MBean you do have created (which I presume came from a WebAppContext) is not being displayed in the AMS dashboard. I didn't see anything odd in your agent.log. Can you attach the AMS_HOME/server.../logs/server.log as well?



                  • #10
                    Attached is my server.log file.


                    • #11
                      Nothing useful there either, unfortunately. Looks like I'll have to try to repro. If you don't mind, could you private message me the bundle containing the Armadillo Key Generator? Else I'll try to duplicate it locally, though we have several local tests that seem to pass, so I'm not sure what is causing your specific situation...



                      • #12
                        Sorry it has been awhile. I created a simple bundle to see if I could get it to work, but am still having same problem. The goal is to have AMS give us metric data on the CounterService's current count. Right now the only groups that show up under dm Server in AMS are:

                        SpringSource dm Server 1.0 Cache
                        SpringSource dm Server 1.0 Global Request Processor
                        SpringSource dm Server 1.0 JSP Monitor
                        SpringSource dm Server 1.0 Servlet Monitor
                        SpringSource dm Server 1.0 Thread Pools
                        SpringSource dm Server 1.0 Web Module Stats

                        And in them I see the servlet data for CounterWebService, but nothing of CounterService. Thank you.

                        Attached is the test bundle I've been working with. Thank you.


                        • #13
                          Hi there,

                          We have almost the same problem. We have the service which is deployed into the Spring DM Server enterprise edition. We are able to see our service and itsd corresponding metrics by means of jconsole, but we have problems to manage our spring bean services in the AMS. Our service is rather simple. Here is the code

                          import java.text.SimpleDateFormat;
                          import java.util.Calendar;
                          import org.springframework.jmx.export.annotation.ManagedOperation;
                          import org.springframework.stereotype.Service;
                          public class TestServiceImpl implements TestService {
                              public String getTime() {
                                  return new SimpleDateFormat("yyyy.MM.dd").format(Calendar.getInstance().getTime());
                          Could you please suggest how to configure the AMS and DM to be able to manage separate beans? And where in the AMS we can manage them.

                          Thanks in advance


                          • #14
                            Are you using dm Server Enterprise Edition? If so, beans marked with @Service should get automatically exposed in JConsole under the "spring.application" domain and should be picked up automatically by AMS as services under the dm Server (using the values provided by the " type" and "name" key properties of the MBean).

                            If you are not using dm Server Enterprise Edition, but are using AMS 2.0, you should still be able to expose your own services to AMS. Details on the ObjectName format and ModelMBean descriptor fields required can be found here:


                            • #15
                              Yes, we are using spring dm enterprise edition. We have managed to resolve the problem. All we had to do is to set system property when starting spring dm. We were able to see exposed service by means of jconsole, but not AMS.