Announcement Announcement Module
No announcement yet.
Problem exposing @Service as @ManagedResource Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem exposing @Service as @ManagedResource

    I have a service that uses 2.5 annotation-based transactions that's annotation instantiated that I'm trying to expose as an MBean.
    The service works fine but it's not exported as an MBean.

    Is there a known issue with @ManagedResource and AOP proxied classes such as this?

    @ManagedResource(objectName="ConnectedDesktop:name =ProductService")
    public class ProductService implements IProductService
    @ManagedAttribute(description="average execution time")
    public int getAverageExecutionTime() { ... }

    @Transactional(propagation=Propagation.REQUIRED, isolation=Isolation.READ_COMMITTED)
    public void saveProduct(Product product) { ... }

    My Spring config is as follows:-

    <context:component-scan base-package="com.connecteddesktop"/>

    <bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.A nnotationJmxAttributeSource"/>

    <!-- Use this assembler when AMS is not installed -->

    <bean id="jmxAssembler" class="org.springframework.jmx.export.assembler.Me tadataMBeanInfoAssembler">
    <property name="attributeSource" ref="jmxAttributeSource"/>

    <bean id="jmxNamingStrategy" class="org.springframework.jmx.export.naming.Metad ataNamingStrategy">
    <property name="attributeSource" ref="jmxAttributeSource"/>

    <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="assembler" ref="jmxAssembler"/>
    <property name="namingStrategy" ref="jmxNamingStrategy"/>
    <property name="autodetectModeName" value="AUTODETECT_ASSEMBLER"/>

  • #2
    the mbeanexporter will not pick up your bean since by then it has already been proxied and hence it cannot find any annotation