Hi ..
Here we in the process of finding the MBeans by using two ways... So could you suggest 
me which is the better way.


1) Using with "ejb/mgmt/MEJB" lookup and ManagementHome

Here we need to place the ejb-management.jar into server/default/deploy folder to find 
out
Sample code :

Properties env = new Properties();
Hashtable ht = new Hashtable();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");

    InitialContext ctx = new InitialContext(env);


Object objpl = null;
NamingContext nc = null;
NamingEnumeration ne = null;

objpl= ctx.lookup("ejb/mgmt/MEJB");


ManagementHome home =
(ManagementHome)PortableRemoteObject.narrow(objref,
ManagementHome.class);
Management mejb = home.create();

String domain = mejb.getDefaultDomain();
Set names = mejb.queryNames(new ObjectName(domain +":j2eeType=J2EEServer,*"), null);

Iterator itr = names.iterator();
while(itr.hasNext()) {
ObjectName name = (ObjectName)itr.next();
System.out.println("EJBModule: " + name);
//ObjectName ejbs = (ObjectName)
String temp =(String)mejb.getAttribute(name, "ServerVersion");
System.out.println("ServerVendor "+temp);


==============

2) Using with RMIAdaptor 


Sample Code:

    objpl = ctx.lookup("jmx/invoker/RMIAdaptor");
RMIAdaptor rad = (RMIAdaptor)PortableRemoteObject.narrow(objpl,RMIAdaptor.class);
String domain = rad.getDefaultDomain();

Set names = rad.queryNames(new ObjectName("jboss.system:type=ServerInfo"),null);
System.out.println("QuerryNames: " + names);
Iterator itr = names.iterator();
ObjectName name = (ObjectName)itr.next();
String temp = (String)rad.getAttribute(name,"HostAddress");
System.out.println("AttributeValue "+temp);

============


If we use ManagementHome we have to copy that ejb-management.jar into deploy folder 
specifically  know. So pls. suggest me which is the better way to follow up.


Thanks & Regards,
Srikanth Kondeti

<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827061#3827061";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827061>Reply 
to the post</a>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to