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

  • HibernatingInSpring
    started a topic AMS not detecting exported beans

    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.

    Thanks.

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

    Leave a comment:


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

    Regards

    Leave a comment:


  • mSX
    replied
    We have implemented an osgi fragment for the com.springsource.management.adapter.jmx 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).

    Leave a comment:


  • pa7751
    replied
    So then what is the workaround for this problem in the EE?

    Leave a comment:


  • mSX
    replied
    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\com.springsource.se rver.management\com.springsource.server.management .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.

    Leave a comment:


  • pa7751
    replied
    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?

    Leave a comment:


  • mSX
    replied
    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.

    Leave a comment:


  • pa7751
    replied
    Hi

    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?

    thanks

    Leave a comment:


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

    Leave a comment:


  • pa7751
    replied
    Hi

    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?

    Thanks

    Leave a comment:


  • mSX
    replied
    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 -Dspring.managed.application.name=MyApp as startup parameter of the spring dm server

    or

    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
    Code:
    <property name="template" value="${OBJECT_NAME}:${alias}" />
    just after the
    Code:
    <filter name="template" value="${OBJECT_NAME}:${alias}" />

    Leave a comment:


  • pa7751
    replied
    Hi

    I have a similar problem. I have a queue listener (using DMLC) that is listening to an ActiveMQ(actually FuseMQ 5.3.0.4). 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:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    		http://www.springframework.org/schem...-beans-2.0.xsd
    		http://www.springframework.org/schema/context
    		http://www.springframework.org/schema/context/spring-context.xsd">
    
    		<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    			<property name="brokerURL">
    				<value>tcp://localhost:61616</value>
    			</property>
    		</bean>
    		
    		<!-- JMX -->
    		<context:mbean-export />
    
    		<bean id="testq" class="org.apache.activemq.command.ActiveMQQueue">
    			<constructor-arg index="0" value="testq" />
    		</bean>
    		
    		<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    			<property name="connectionFactory" ref="connectionFactory"/>
    		</bean>
    		
    		<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>
    		
    		<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" />
    		</bean>
    </beans>
    JMSReceiver.java
    Code:
    import java.util.HashMap;
    
    import org.springframework.jmx.export.annotation.ManagedOperation;
    import org.springframework.jmx.export.annotation.ManagedResource;
    
    import com.springsource.management.adapter.jmx.ManagedMetric;
    import com.springsource.management.agent.inventory.resource.metric.MetricCategory;
    import com.springsource.management.agent.inventory.resource.metric.MetricType;
    
    
    @ManagedResource(objectName = "spring.application:application=ams.test,type=MessageListener,name=JMSListener")
    public class JMSReceiver {
    	public JMSReceiver() {}
    	
    	
    	@ManagedOperation
    	public void processMessages(HashMap message) {
    		try {
    			String name = (String)message.get("name");
    			Thread.sleep(7500);
    			System.out.println("Received Message:" + name);
    		}
    		catch(Exception e) {
    			e.printStackTrace();
    		}
    	}
    }
    MANIFEST.MF
    Code:
    Manifest-Version: 1.0
    Bundle-Version: 1.0.0
    Tool: Bundlor 1.0.0.BUILD-20090616142719
    Bundle-Name: ReceiverBundle
    Bundle-ManifestVersion: 2
    Import-Package: com.springsource.management.adapter.jmx,org.apache.act
     ivemq,org.apache.activemq.command,org.springframework.jms.core,org.sp
     ringframework.jms.listener,org.springframework.jms.listener.adapter,o
     rg.springframework.jmx.export.annotation
    Bundle-SymbolicName: ReceiverBundle
    Import-Bundle: com.springsource.management.agent.inventory;version="[2.5.6.SEC01,2.5.6.SEC01]",
     com.springsource.management.agent.monitoring;version="[2.5.6.SEC01,2.5.6.SEC01]"
    .classpath file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    	<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"/>
    </classpath>
    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.

    Leave a comment:


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

    Leave a comment:


  • jencompgeek
    replied
    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: http://static.springsource.com/proje...ith%20AMS.html

    Leave a comment:

Working...
X