[jboss-user] [Microcontainer] - Re: Does the Microcontainer register MBeans that it deploys

Gary Marsh do-not-reply at jboss.com
Mon Dec 15 15:49:10 EST 2008


AlesJ.  

Ok.. I added the start() method and executed the queryName() call from inside this method printed out the ObjectNames and I don't see the two MBeans I deployed in my nichpro-beans.xml configuration file.

DataManagementServer. java code :


  | public class DataManagementServer    {
  | 
  |     private   MBeanServer mbeanServer = null;
  |  
  |     private static final String MONITOR_MANAGER = "MonitorMgmt";
  | 
  |     static Logger logger = Logger.getLogger( DataManagementServer.class );
  | 
  |     // ////////// End of MBeanReg Declaration ////////////////
  |     public DataManagementServer(MBeanServer mbeanServer ) {
  |                                              
  |         this.mbeanServer = mbeanServer;
  |                       
  |     }
  | 
  |     public void start() {
  |        System.out.println("Starting DataManagementServer....");
  |        
  |         Set<ObjectName> mbObjectNames = mbeanServer.queryNames( null, null );
  |         
  |         int cnt = 1;
  |         for( ObjectName on : mbObjectNames){
  |             System.out.println("ObjectName "+ (cnt++) +" ="+ on);
  |         }
  | 
  |         
  |     }
  |  

The nichpro-beans.xml code :


  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  | 
  |    <!-- -->
  |   
  |     <bean  name="DataProc" class="com.nichpro.jmx.processing.data.DataProc" >
  |         <property name="associatedType">DataDirMonitor</property>
  |     </bean>
  |     
  |     <bean name="DataDirMonitor" class="com.nichpro.jmx.scandir.monitor.data.DataDirMonitor"  > 
  |         <constructor>           
  |             <parameter>/NichPro/NP_ScanDirectory/Data</parameter>
  |         </constructor>
  |         <property name="associatedType">DataProc</property>       
  |     </bean>    
  |     
  |        <bean name="DMServer" class="com.nichpro.jmx.server.DataManagementServer">
  |         <constructor>
  |             <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
  |         </constructor>                
  |    </bean>
  |     
  | </deployment>
  | 
  | 

I placed a start() method in each of the MBeans that I created (DataProc and DirMonitor)  and printed out that it is started so I could be sure it actually started and this is the output :


  | Using bootstrap: file:/C:/NichPro/MicrocontainerDirectoryScanner/src/META-INF/bootstrap-beans.xml
  | Deployed URL: file:/C:/NichPro/MicrocontainerDirectoryScanner/src/META-INF/system-jmx-beans.xml
  | Deployed URL: file:/C:/NichPro/MicrocontainerDirectoryScanner/src/META-INF/aop-beans.xml
  | Starting DataProc...
  | I am monitoring /NichPro/NP_ScanDirectory/Data directory.
  | Starting DirMonitor...
  | Data Directory is empty....
  | Going to sleep for 15 minutes now....
  | Starting DataManagementServer....
  | ObjectName 1 =JMImplementation:type=MBeanRegistry
  | ObjectName 2 =jboss.classloader:service=ClassLoaderSystem
  | ObjectName 3 =JMImplementation:service=LoaderRepository,name=Default
  | ObjectName 4 =JMImplementation:type=MBeanServerDelegate
  | Deployed URL: file:/C:/NichPro/MicrocontainerDirectoryScanner/src/META-INF/nichpro-beans.xml
  | 
  | 
  | As I mentioned before even though it appears that the DataProc and DirMonitor MBeans were deployed they do not appear in the Set returned by the call to mbeanServer.queryName() .
  | 
  | I hope this makes my dilemma more understandable.  I need to have access and association of these MBeans to the MBeanServer so I can use the MBean notification functionality.  So how do I get this association?
  | 
  | Regards,
  | GMarsh

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196702#4196702

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196702



More information about the jboss-user mailing list