WHO ever use org.jboss.jmx.adaptor.rmi.RMIAdaptor to do a Real REMOTE call to MBean in JBoss?
From: hoop (michael.li_at_zyxel.cn)
Date: 12/17/03
- Next message: Y2KYZFR1: "Re: can't import class in default package???"
- Previous message: Ville Oikarinen: "Re: can't import class in default package???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 17 Dec 2003 17:12:15 +0800
Error output:
[java] javax.naming.NameNotFoundException: jmx:COMSERVER:rmi not bound
[java] at
org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
[java] at
org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
[java] at
org.jnp.server.NamingServer.getObject(NamingServer.java:509)
[java] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
[java] at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown
Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
[java] at sun.rmi.transport.Transport$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native
Method)
[java] at sun.rmi.transport.Transport.serviceCall(Unknown Source)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
[java] at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
[java] at java.lang.Thread.run(Unknown Source)
[java] at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown
Source)
[java] at sun.rmi.server.UnicastRef.invoke(Unknown Source)
[java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
[java] at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
[java] at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
[java] at javax.naming.InitialContext.lookup(Unknown Source)
[java] at
com.zyxel.vantage.comserver.testsessionbean.Client.test(Unknown Source)
[java] at
com.zyxel.vantage.comserver.testsessionbean.Client.main(Unknown Source)
Source codes:
public static void test()
throws javax.naming.NamingException {
// The server name to connect to
String serverName = null;
InetAddress IP = null;
try{
if (serverName == null)
{
//serverName = InetAddress.getLocalHost().getHostName();
IP =InetAddress.getByName("172.31.0.76"); //remote host ip
here
serverName = IP.getHostName();
System.out.println(serverName);
}
Properties props = new Properties();
props.put(
Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "ComServer :1099");//"ComServer"
remote host
System.out.println(serverName);
InitialContext ic = new InitialContext(props);
RMIAdaptor server =
(RMIAdaptor) ic.lookup("jmx:" + serverName + ":rmi");
// Get the MBeanInfo for the JNDIView MBean
ObjectName name = new ObjectName("jboss:service=JNDIView");
MBeanInfo info = server.getMBeanInfo(name);
System.out.println("JNDIView Class: " + info.getClassName());
MBeanOperationInfo[] opInfo = info.getOperations();
System.out.println("JNDIView Operations: ");
for (int o = 0; o < opInfo.length; o++) {
MBeanOperationInfo op = opInfo[o];
String returnType = op.getReturnType();
String opName = op.getName();
System.out.print(" + " + returnType + " " + opName + "(");
MBeanParameterInfo[] params = op.getSignature();
for (int p = 0; p < params.length; p++) {
MBeanParameterInfo paramInfo = params[p];
String pname = paramInfo.getName();
String type = paramInfo.getType();
if (pname.equals(type))
System.out.print(type);
else
System.out.print(type + " " + name);
if (p < params.length - 1)
System.out.print(',');
}
System.out.println(")");
}
//Invoke the list(boolean) op
String[] sig = { "boolean" };
Object[] opArgs = { Boolean.TRUE };
Object result = server.invoke(name, "list", opArgs, sig);
System.out.println("JNDIView.list(true) output:\n" + result);
}
catch (Exception e){
e.printStackTrace();
}
}
- Next message: Y2KYZFR1: "Re: can't import class in default package???"
- Previous message: Ville Oikarinen: "Re: can't import class in default package???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]