Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> OracleAS 10.1.3 problem on accessing MBean from remote Java client
Has anyone tried using developer's preview 3? I'm having problem to
invoke method in AggreMBean. No luck yet find the API for DMS either
(i.e. need doc on oracle.dms.jmx.NamedValue). The following is the
exception I'm getting, the descriptions from JMX console and the simple
JMX client's code.
>> Exception in thread "main" javax.management.ReflectionException: The
method null.getTableNames could not be found
>> Caused by: java.lang.NoSuchMethodException:
oracle.dms.jmx.SpyMBean.getTableNames(java.lang.String,
oracle.dms.jmx.NamedValue, oracle.dms.jmx.NamedValue)
According to the JMX console ...
Method name
import java.rmi.RemoteException;
import java.util.Hashtable;
import javax.ejb.CreateException; import javax.management.ObjectName; import javax.management.j2ee.Management; import javax.management.j2ee.ManagementHome; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.rmi.PortableRemoteObject;
import oracle.dms.jmx.NamedValue;
import oracle.dms.jmx.NamedValueSupport;
public class MyOracleASJMXClient {
public static void main(String[] args) throws Exception {
Hashtable env = new Hashtable(); String url = "ormi://localhost:23791/default"; env.put(Context.PROVIDER_URL, url); env.put(Context.SECURITY_PRINCIPAL, "admin"); env.put(Context.SECURITY_CREDENTIALS, "welcome"); System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.ApplicationClientInitialContextFactory");
Object hm; try { Context ctx = new InitialContext(env); hm = ctx.lookup("java:comp/env/ejb/mgmt/MEJB"); } catch (NamingException ne) { throw ne; } ManagementHome mgmtHome = (ManagementHome) PortableRemoteObject.narrow( hm, ManagementHome.class); try { Management mejb = mgmtHome.create(); ObjectName objName = new ObjectName("default:type=AggreMBean"); NamedValue namedValue = new NamedValueSupport("table", "oc4j_ejb_method"); Object retObj = mejb.invoke(objName, "getTableNames", new Object[] { null, null, null }, new String[] { "java.lang.String", "oracle.dms.jmx.NamedValue","oracle.dms.jmx.NamedValue" });
} catch (RemoteException re) { re.printStackTrace(); } catch (CreateException ce) { ce.printStackTrace(); }