Announcement Announcement Module
Collapse
No announcement yet.
MBeanExporter for proxies Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBeanExporter for proxies

    Hi all,

    I would like to export a transactional proxy to a bean as JMX MBean.

    Here is the configuration:

    Code:
        <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
            <property name="interceptorNames" value="transactionInterceptor"/>
            <property name="beanNames">
                <list>
                    <value>packageCalculatorService</value>
                </list>
            </property>
        </bean>
    
        <bean id="exporter"  class="org.springframework.jmx.export.MBeanExporter">
            <property name="beans">
                <map>
                    <entry key="tams&#58;service=packageCalculator">
                        <ref local="packageCalculatorService"/>
                    </entry>
                </map>
            </property>
         ...
         </bean>
    The problem is that MBeanExporter does not export the proxy but the proxied bean.

    What can I do to solve this ?

    Regards,

    J-F

  • #2
    Are you saying that the actual target object is exposed rather than the proxy?

    Rob

    Comment


    • #3
      Yes, exactly.

      In JBoss web console, I see that class name is not a $Proxy name, but the class name of the target bean.

      J-F

      Comment


      • #4
        This behavior is to be expected. Behind the scenes, Spring will unwrap the proxy to find the actual target class. Without this step, JDK proxies will not work correctly when to JMX in all JMX implementations.

        It is important to note that proxy itself is still exposed, we just report its actual class to JMX rather tell JMX to class of the proxy.

        Regards,

        Rob

        Comment


        • #5
          So, if I understand correctly, the proxy is bound to MBean server, but Spring fools the server pretending the proxy is of the proxied class type.

          If it is the case, sorry for my posting. I was mislead by the class name in JBoss console.

          Thanks for support,

          J-F

          Comment


          • #6
            That is correct - this behavior is needed so that JDK proxies work correctly in all JMX implementations.

            Rob

            Comment

            Working...
            X