Announcement Announcement Module
Collapse
No announcement yet.
Problem exposing @Service as @ManagedResource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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?

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

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

    My Spring config is as follows:-

    <context:annotation-config/>
    <context:component-scan base-package="com.connecteddesktop"/>
    <tx:annotation-driven/>

    <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>

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

    <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"/>
    </bean>

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

    Comment

    Working...
    X