[JBoss-user] [Management, JMX/JBoss] - Re: JMX RMI Connector from JDK1.5
Will this approach work with other app servers? Probably. I am in the middle of preparing a presentation for a conference in December (paper deadline is June 16th!) and I cover JMX (which is why I had a small example app already prepared). I was going to try it with other app servers so I could give the audience some ideas on accessing other app servers, though that won't make the deadline cuz the week of June 12 I will be partying in Vegas (I mean, "attending JBossWorld and learning about all the latest JBoss-related technologies"; hope my boss doesn't read this forum!) Not sure on registering for notifications, though. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948805#3948805 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948805 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Re: JMX RMI Connector from JDK1.5
Hi Peter, Thanks for the suggestion. Do you by any chance know if this approach is applicable across different JMX containers, for example, WebLogic Server? Anther issue might be the registration of notifications remotely -- can I register for notifications remotely with the MBeanServerConnection obtained in this manner? The other reason I'd like to use native JMX RMI connector is that I can access other JMX container as well. It appears remoting service from JBOSS 5 might be the answer to this. see http://wiki.jboss.org/wiki/Wiki.jsp?page=JMX_Remoting_service_configuration I'm not sure when this feature will be backported into JBOSS4.x though. Thanks. Wen View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948802#3948802 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948802 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Management, JMX/JBoss] - Re: JMX RMI Connector from JDK1.5
Yes, you can easily write a Java app to access MBeans within JBoss, and you don't need JDK 5 to do it. Here is some simple code that prints out the attribute value of a particular mbean: package foo.bar; | import java.util.Hashtable; | import javax.management.MBeanServerConnection; | import javax.management.ObjectName; | import javax.naming.Context; | import javax.naming.InitialContext; | public class MBean { | public static void main(String[] args) throws Exception { | Hashtable env = new Hashtable(); | String factory = "org.jnp.interfaces.NamingContextFactory"; | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); | String url1 = "jnp://localhost:1099"; | env.put(Context.PROVIDER_URL, url1); | Context ctx = new InitialContext(env); | MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor"); | ObjectName name = new ObjectName("jboss.jca:name=ds/ProductDS,service=ManagedConnectionPool"); | Object val = mconn.getAttribute(name, "InUseConnectionCount"); | System.out.println(name + "\n\tInUseConnectionCount=" + val); | } | } Note that the MBeanServerConnection is accessed via JNDI, and not via a JMXServiceURL. (My search for a way to use a JMXServiceURL never turned up any schemes that worked.) View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948793#3948793 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948793 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user