I am trying to do a test application that creates a ServiceMBean and that I can 
connect to from a client application to read and invoke methods and as a listener.  I 
am using JBoss 3.2.3.

I was successful connecting to the MBean Server with the RMIAdaptor to read info on 
the MBean and invoke methods.  

I created a seperate application for the listener using the RMIConnectorImpl class.  
Here is the code:

import javax.management.ObjectName;
import javax.management.NotificationListener;
import javax.management.Notification;

import javax.naming.Context;
import org.jboss.jmx.connector.rmi.RMIConnectorImpl;

public class JmxListener
    implements NotificationListener {

  public static void main(String[] args) throws Exception {
    JmxListener jmxListener = new JmxListener();
    jmxListener.runTest();
    while (true) {

    }
  }

  public void runTest() throws Exception {
    System.out.println("Setting naming context");

    System.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                       "org.jnp.interfaces.NamingContextFactory");
    System.setProperty(Context.URL_PKG_PREFIXES,
                       "org.jboss.naming:org.jnp.interfaces");

    System.out.println("Creating an RMI connector");
    RMIConnectorImpl server = new RMIConnectorImpl(RMIConnectorImpl.
        NOTIFICATION_TYPE_RMI, null, "localhost");

    if (server != null) {
      ObjectName name = new ObjectName("JBossSar:service=JBossTestService");

      System.out.println("Starting to listen....");
      server.addNotificationListener(name, this, null, null);
    }

  }

  public void handleNotification(Notification notification, Object HandBackObj) {
    System.out.println("Notification occured ......");
  }

}


I am getting an error
javax.naming.NameNotFoundException: jmx:localhost:rmi not bound
when creating new RMIConnectorImpl

When I look in the Agent view there is no RMIConnector service only the RMIAdaptor 
service.
In my client application when I run the code to check if the RMIConnector is 
registered I get a false.
      boolean rmiConnectorIsRegistered = server.isRegistered(new ObjectName(
          "DefaultDomain:service=RMIConnector"));

Is the problem that I have to configure the RMIConnector and if so, how do I do that 
or is there some other problem?  Thanks.


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823353#3823353

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823353


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to