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

  • #16

    I have a similar problem. I have a queue listener (using DMLC) that is listening to an ActiveMQ(actually FuseMQ Please suggest how can I get my bundle detected by AMS.

    I am using AMS 2.0, community version and dm-server-1.0.2.SR02 (this one comes with the STS installer itself). I have replaced all the bundles with their instrumented versions in the dm-server-1.0.2.SR02\repository\bundles\ext folder. Is that all that we need to or am I missing anything? Below is my code for clarity:

    Spring config file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""
    		<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    			<property name="brokerURL">
    		<!-- JMX -->
    		<context:mbean-export />
    		<bean id="testq" class="org.apache.activemq.command.ActiveMQQueue">
    			<constructor-arg index="0" value="testq" />
    		<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    			<property name="connectionFactory" ref="connectionFactory"/>
    		<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    			<property name="connectionFactory" ref="connectionFactory" />
    			<property name="destination" ref="testq" />
    			<property name="messageListener" ref="purePojoMdp" />
    			<property name="concurrentConsumers" value="5" />
    			<property name="maxConcurrentConsumers" value="15" />
    		<bean id="receiver" class="JMSReceiver" />
    		<bean id="purePojoMdp" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
    			<property name="delegate" ref="receiver" />
    			<property name="defaultListenerMethod" value="processMessages" />
    import java.util.HashMap;
    import org.springframework.jmx.export.annotation.ManagedOperation;
    import org.springframework.jmx.export.annotation.ManagedResource;
    @ManagedResource(objectName = "spring.application:application=ams.test,type=MessageListener,name=JMSListener")
    public class JMSReceiver {
    	public JMSReceiver() {}
    	public void processMessages(HashMap message) {
    		try {
    			String name = (String)message.get("name");
    			System.out.println("Received Message:" + name);
    		catch(Exception e) {
    Manifest-Version: 1.0
    Bundle-Version: 1.0.0
    Tool: Bundlor 1.0.0.BUILD-20090616142719
    Bundle-Name: ReceiverBundle
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: ReceiverBundle
    .classpath file
    <?xml version="1.0" encoding="UTF-8"?>
    	<classpathentry kind="src" path="src"/>
    	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    	<classpathentry kind="con" path="com.springsource.server.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER"/>
    	<classpathentry kind="output" path="bin"/>
    Although I am able to see the "ActiveMQ 4.0 testq localhost Queue" and the "SpringSource dm Server 1.0" in AMS console, these do not show any metrics for the things that I am trying to monitor i.e. my MDP application and the testq. Please advise how can I monitor these. Do we need to get the enterprise versions of the softwares or am I missing anything?
    Last edited by pa7751; Sep 29th, 2009, 08:03 AM.


    • #17
      Unfortunately we were unable to have custom components deployed into a community version of spring dm server with replaced jars to be detected by means of ams.

      You can try to
      1. add system property as startup parameter of the spring dm server


      2. modify springsource-dm-server-plugin.jar in both ams server and ams agent changing springsource-dm-server-plugin.jar\etc\hq-plugin.xml. You have to add
      <property name="template" value="${OBJECT_NAME}:${alias}" />
      just after the
      <filter name="template" value="${OBJECT_NAME}:${alias}" />


      • #18

        Thanks a lot. With the suggested settings I was able to get the things in AMS. Could you please suggest the settings for the ActiveMQ as well? Now that I am able to monitor my MDP, what needs to be done to get the ActiveMQ as well?



        • #19
          We haven't work with activemq+ams together, but maybe this link will help.


          • #20

            I have another doubt if you could please help.

            If you see my code, I am having a processMessages method that is annotated for monitoring. It is just a listener i.e. an onMessage() . I am able to see this in my Control Actions in AMS, but I am not sure how to monitor it.

            Once I deploy my MDP in dmserver, it will continuosly listen to the queue. This is working fine. If I monitor this method what all things can I expect AMS to give to me and how can I configure AMS to give me all that for this method?



            • #21
              Have you seen this link? You are trying to have metrics for your custom component, so you are responsible for creating metrics you are going to see.

              To be able to have performance metrics automatically you have to use stereotype annotations i.e. @Service, @Component, @Controller, etc., but as I mentioned we were unable to make spring dm server community edition export such metrics, and the 1.0.2 version of spring dm server enterprise edition has a bug, that does not allow to export performance metrics correctly without patching internal spring dm server bundles.


              • #22
                Thanks for this useful information. So we cannot have these metrics exported with the dm server that I am using..okay..but I am not sure if the dm-server-1.0.2.SR02 that I am using is community or an evaluation version of the enterprise version. Any clue on that please?

                spring dm server enterprise edition has a bug, that does not allow to export performance metrics correctly without patching internal spring dm server bundles.
                So what are those specific bundles for which we will need the patches? Are these patches only available with the enterprise version?


                • #23
                  Spring DM EE contains instrumented version of spring jars, so you don't need to replace ones.

                  So what are those specific bundles for which we will need the patches? Are these patches only available with the enterprise version?
                  There is no patch for Enterprise and community versions. The problem jar is "repository\bundles\subsystems\\ .core-1.0.2.RELEASE.jar" - it depends on obsolete version of instrumented spring and does not allow to replace spring jars with the new ones. The main problem is that AMS creates autogroups for the resources of the same type, and all the resources in one autogroup must have the same metrics and control options.


                  • #24
                    So then what is the workaround for this problem in the EE?


                    • #25
                      We have implemented an osgi fragment for the bundle. This fragment uses custom BeanFactoryPostProcessor that replaces jmxManagedResourceExporter in the context of the bundle with the ours exporter. Out exporter overrides managedResourceAdded method replacing the first paramter of type ManagedResourceName with the new one that can uniquely identify managed resource of the certain type (class).


                      • #26
                        Okay so that's your own custom implementation then. Is there a jira logged for the bug yet?



                        • #27
                          I emailed to spring support more than month ago. There is no reply by the moment.