🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #20570

WHO ever use org.jboss.jmx.adaptor.rmi.RMIAdaptor to do a Real REMOTE call to MBean in JBoss?

#20570
From: hoop
Date: Wed, 17 Dec 2003 09:13
115 lines
5544 bytes
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: <brp6m9$1e73$1@mail.cn99.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!feed.news.tiscali.de!newsfeed01.sul.t-online.de!t-online.de!news.cn99.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6cb0,a374c253f9c84f1,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-12-17 01:12:52 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!feed.news.tiscali.de!newsfeed01.sul.t-online.de!t-online.de!news.cn99.com!not-for-mail
From: "hoop" <michael.li@zyxel.cn>
Newsgroups: cn.bbs.comp.lang.java
Subject: WHO ever use org.jboss.jmx.adaptor.rmi.RMIAdaptor to do a Real REMOTE call to MBean in JBoss?
Date: Wed, 17 Dec 2003 17:13:26 +0800
Organization: Bentium Ltd. (CN99)
Lines: 118
Message-ID: <brp6m9$1e73$1@mail.cn99.com>
NNTP-Posting-Host: 218.68.217.208
X-Trace: mail.cn99.com 1071652361 47331 218.68.217.208 (17 Dec 2003 09:12:41 GMT)
X-Complaints-To: usenet@news.cn99.com
NNTP-Posting-Date: Wed, 17 Dec 2003 09:12:41 +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