Hi,
executing
if (System.getSecurityManager() == null) {
| System.setSecurityManager(new
RMISecurityManager());
| }
| 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/DefaultDS,service=ManagedConnectionPool");
| Object val = mconn.getAttribute(name, "InUseConnectionCount");
| System.out.println(name + "\n\tInUseConnectionCount=" + val);
leads to:
anonymous wrote : javax.management.InstanceNotFoundException:
jboss.jca:name=ds/DefaultDS,service=ManagedConnectionPool is not registered.
| at
org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:523)
| at
org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:550)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:266)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at
org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:108)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at
org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
| at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
| at sun.rmi.transport.Transport$1.run(Transport.java:153)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
| at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
| at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
| at java.lang.Thread.run(Thread.java:595)
I'm not sure I made myself quite clear on what i want to do. I want to obtain a
reference to a Bean of my own, deployed in JBoss named WorldMBean which extends
the interface World.
What exactly are the lines
ObjectName name = new
ObjectName("jboss.jca:name=ds/DefaultDS,service=ManagedConnectionPool");
| Object val = mconn.getAttribute(name, "InUseConnectionCount");
| System.out.println(name + "\n\tInUseConnectionCount=" + val);
supposed to do?
I was originally trying to adapt the code found in the trail at:
http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/jmx/code/calculator.jsp.html
only I'm using a java client not a jsp. I'm not sure if the code in the jsp is
only supposed to work locally because of:
MBeanServer server = MBeanServerLocator.locate();
If so is there a simple way to get a reference to my MBeanServer on the same
machine but not in the same VM?
Thanks for your help
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952957#3952957
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952957
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user