>From your code examples, it appears that you are binding the MBean into the LOCAL 
>JNDI of the server then trying to fetch it using the LOCAL JNDI of the other server.

If you want to place the MBean in the HA-JNDI, you will need to create the initial 
context on that server as follows:

Properties prop = new Properties();
  | prop.put(Context.INITIAL_CONTEXT_FACTORY,   
  |     "org.jnp.interfaces.NamingContextFactory");
  | prop.put(Context.URL_PKG_PREFIXES,
  |     "org.jboss.naming:org.jnp.interfaces");
  | prop.put(Context.PROVIDER_URL,      
  |     "");
  | InitialContext jndiContext = new InitialContext(prop);

Then, store the MBean into the context.

On the other server, you will need to do the same InitialContext setup, then you 
should be able to perform the lookup via HA-JNDI.

The other problem you will run into with this is that MBeans on a remote server need 
to be accessed via a RMIAdaptor, so that the actual calls go across the network and 
run against the MBean that is actually running on the remote server.  I have found 
that it is better to lookup the RMIAdaptor on the remote server via the remote 
server's local JNDI, then use that RMIAdaptor to call the MBean functions:

         Properties props = new Properties();
  |          props.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
  |          props.put(Context.URL_PKG_PREFIXES, 
"org.jboss.naming:org.jnp.interfaces");
  |          props.put(Context.PROVIDER_URL, "jnp://myserver:1099");
  |          InitialContext ctx = new InitialContext(props);
  |          Object obj = ctx.lookup("jmx/rmi/RMIAdaptor");
  |          if (!(obj instanceof RMIAdaptor)) {
  |             throw new ClassCastException
  |                ("Object not of type: RMIAdaptorImpl, but: " +
  |                 (obj == null ? "not found" : obj.getClass().getName()));
  |          }
  |          RemoteMBeanServer server = new RMIConnectorImpl((RMIAdaptor)obj);

The RemoteMBeanServer instance provides all of the same functionality as the standard 
MBeanServer, with additional infrastructure to support RMI.

<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823863#3823863";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823863>Reply 
to the post</a>


-------------------------------------------------------
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