1 2 Previous Next 19 Replies Latest reply on Mar 5, 2007 11:14 AM by vickyk Go to original post
      • 15. Re: Evaluating IOC Containers
        vickyk

        Ales , Can you too test this
        1) I have POJO

        public class SimplePojo implements SimplePojoMBean
        {
         public void display(){
         System.out.println("Hello ");
         }
        }
        


        2) POJO MBean Interface as
        public interface SimplePojoMBean
        {
         public void display();
        }
        


        3)pojo-beans.xml as
        <?xml version="1.0" encoding="UTF-8"?>
        
        <!-- deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
         xmlns="urn:jboss:bean-deployer:2.0" -->
        <deployment xmlns="urn:jboss:bean-deployer:2.0">
        
         <!-- bean name="MBeanServer" class="java.lang.Object">
         <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="createMBeanServer"/>
         </bean -->
        
         <!-- bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
        
         <bean name="AspectManager" class="org.jboss.aop.AspectManager">
         <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
         </bean>
        
         <!-- aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
         name="DependencyAdvice"
         class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction"
         classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX"
         pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
         <property name="mbeanServer"><inject bean="MBeanServer"/></property>
         </aop:lifecycle-configure -->
        
         <bean name="SimplePojo" class="org.jboss.mc.SimplePojo">
        
         <!-- FIXME restore the property replacement on the partition name once JBMICROCONT-143 is fixed -->
         <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=POJO", exposedInterface=org.jboss.mc.SimplePojoMBean.class, registerDirectly=true)</annotation>
         </bean>
        
        </deployment>


        I prepared the pojo.jar which contians SimplePojo and SimplePojoMBean .I am keeping this at Jboss-5.0.0.Beta1\server\default\lib
        I have kept the pojo-beans.xml file at the Jboss-5.0.0.Beta1\server\default\deploy .
        I would expect the SimplePojoMBean getting registered in Mbean server , but I am not able to look this bean at jmx-console .
        What is wrong here ?


        • 16. Re: Evaluating IOC Containers
          alesj

          Your xml is commented - with <!--.
          Turn on debuging / trace log for more info.

          • 17. Re: Evaluating IOC Containers
            vickyk

            I don't think comments in xml will cause any problem , the pojo-beans.xml contains only one bean .

            Turn on debuging / trace log for more info.

            Yes this is the last option left now :(

            • 18. Re: Evaluating IOC Containers
              alesj

              No, you need this piece of xml code to integrate aop aspects with pojo instantiation - order matters (add dependency if needed).

              This is a small example I've done for Seam, and it works.

               <!-- Seam + MC AOP -->
              
               <bean name="SeamAspectManager" class="org.jboss.aop.AspectManager">
               <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
               </bean>
              
               <beanfactory name="SeamAdvice" class="org.jboss.seam.ioc.microcontainer.SeamIntroduction"/>
              
               <bean name="SeamAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
               <property name="advice"><inject bean="SeamAdvice"/></property>
               <property name="manager"><inject bean="SeamAspectManager"/></property>
               </bean>
              
               <bean name="SeamIntroduction" class="org.jboss.aop.microcontainer.beans.IntroductionBinding">
               <property name="classes">@org.jboss.seam.annotations.Name</property>
               <property name="interfaces">
               <list elementClass="java.lang.String">
               <value>org.jboss.kernel.spi.dependency.KernelControllerContextAware</value>
               </list>
               </property>
               <property name="manager"><inject bean="SeamAspectManager"/></property>
               </bean>
              
               <bean name="SeamBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
               <property name="pointcut">execution(* $instanceof{org.jboss.kernel.spi.dependency.KernelControllerContextAware}->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))</property>
               <property name="aspect"><inject bean="SeamAspect" property="definition"/></property>
               <property name="manager"><inject bean="SeamAspectManager"/></property>
               </bean>
              /code]
              
              It intercepts all MC beans that have Seam's @Name annotation.


              • 19. Re: Evaluating IOC Containers
                vickyk

                Found the problem , it was in the AspectManager .
                When I included org.jboss.mc in
                org.jboss.test, org.jboss.injbossaop, org.jboss.cache.jmx, org.jboss.cache.pojo.jmx, org.jboss.ha, org.jboss.invocation , org.jboss.mc
                it worked ..





                1 2 Previous Next