[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-user
Subject:    [JBoss-user] Remote MBean Invocation
From:       Subramanian Ananthram <SubramanianA () ami ! com>
Date:       2002-09-30 17:59:01
[Download RAW message or body]

Hi,

I am trying to invoke a method on a Mbean remotely (ie) from two different
machines connected on the network.
Below is the snippet of code, i am using to invoke the remote Mbean. Agent
name is the IPaddress of the remote machine and operation name is the name
of the operation  which needs to be invoked.

	 public void invokee(String agentName, String operationName)
	                            throws Exception
	    {
	        
	        
	        RMIAdaptor mRemoteAdaptor;
			Hashtable environment = new Hashtable();       
	        

	
environment.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingCo
ntextFactory" );
	
environment.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.int
erfaces");
		environment.put("java.naming.rmi.security.manager", "yes");
	        environment.put(Context.PROVIDER_URL,agentName);         

		InitialContext context = new InitialContext(environment);

		mRemoteAdaptor =
(RMIAdaptor)context.lookup("jmx:"+agentName+ ":rmi");       
	        
	        ObjectName objectName = new ObjectName("test",
	                                                "service",
	                                                "KCS");
	        String returnValue = (String)
	
mRemoteAdaptor.invoke(objectName,operationName,null,null);

	        System.out.println("### The Value is :"+returnValue+" ###");
	        
	    }

	I get the following error: 
	javax.naming.NameNotFoundException: jmx:155.229.83.31:rmi not bound
	        at
org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
	        at
org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
	        at
org.jnp.server.NamingServer.getObject(NamingServer.java:509)
	        at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
	        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
	        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	        at java.lang.reflect.Method.invoke(Method.java:324)
	        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
	        at sun.rmi.transport.Transport$1.run(Transport.java:148)
	        at java.security.AccessController.doPrivileged(Native
Method)
	        at
sun.rmi.transport.Transport.serviceCall(Transport.java:144)
	        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
	        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
01)
	        at java.lang.Thread.run(Thread.java:536)
	        at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteC
all.java:247)
	        at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
	        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
	        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
	        at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
	        at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
	        at
javax.naming.InitialContext.lookup(InitialContext.java:347)
	        at Agent.invokee(Agent.java:57)
	        at Agent.<init>(Agent.java:18)
	        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
	        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
	        at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	        at
org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:786)
	        at
org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:240)
	        at
org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:267)
	        at
org.jboss.system.ServiceCreator.install(ServiceCreator.java:86)
	        at
org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.jav
a:190)
	        at
org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:153)
	        at
org.jboss.system.ServiceController.install(ServiceController.java:194)
	        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
	        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	        at java.lang.reflect.Method.invoke(Method.java:324)
	        at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispat
cher.java:284)
	        at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
	        at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
	        at $Proxy3.install(Unknown Source)
	        at
org.jboss.deployment.SARDeployer.create(SARDeployer.java:206)
	        at
org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
	        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
	        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
	        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:465)
	        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
	        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	        at java.lang.reflect.Method.invoke(Method.java:324)
	        at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispat
cher.java:284)
	        at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
	        at
org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:314)
	        at
org.jboss.system.server.ServerImpl.start(ServerImpl.java:216)
	        at org.jboss.Main.boot(Main.java:142)
	        at org.jboss.Main$1.run(Main.java:375)
	        at java.lang.Thread.run(Thread.java:536)

	What am I doing wrong here?
	Thanks,
	Subu




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic