Article View: cn.bbs.comp.lang.java
Article #20516Re: WHO ever use org.jboss.jmx.adaptor.rmi.RMIAdaptor to do a Real REMOTE call to MBean in JBoss?
From: hoop
Date: Thu, 18 Dec 2003 02:26
Date: Thu, 18 Dec 2003 02:26
136 lines
6236 bytes
6236 bytes
hoop wrote:
> [java] javax.naming.NameNotFoundException: jmx:COMSERVER:rmi not bound
Please change the adaptor lookup line
> RMIAdaptor server=(RMIAdaptor) ic.lookup("jmx:" + serverName + ":rmi");
to
RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");
-marek
"hoop" <michael.li@zyxel.cn> д���ʼ� news:brp6m9$1e73$1@mail.cn99.com...
> Localhost is ok now,but Remote...
>
>
> 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();
> }
> }
>
>
>
Technical Details
Message-ID:
<brr37e$2joa$1@mail.cn99.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.cn99.com!not-for-mailReferences:
<brp6m9$1e73$1@mail.cn99.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f6cb0,a374c253f9c84f1 X-Google-Attributes: gidf6cb0,public X-Google-ArrivalTime: 2003-12-17 18:25:59 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.cn99.com!not-for-mail From: "hoop" <michael.li@zyxel.cn> Newsgroups: cn.bbs.comp.lang.java Subject: Re: WHO ever use org.jboss.jmx.adaptor.rmi.RMIAdaptor to do a Real REMOTE call to MBean in JBoss? Date: Thu, 18 Dec 2003 10:26:34 +0800 Organization: Bentium Ltd. (CN99) Lines: 138 Message-ID: <brr37e$2joa$1@mail.cn99.com> References: <brp6m9$1e73$1@mail.cn99.com> NNTP-Posting-Host: 218.68.217.208 X-Trace: mail.cn99.com 1071714350 85770 218.68.217.208 (18 Dec 2003 02:25:50 GMT) X-Complaints-To: usenet@news.cn99.com NNTP-Posting-Date: Thu, 18 Dec 2003 02:25:50 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165