Re[JBoss-dev] mote connection to JBoss using RMIAdapter

Lipsy p_ingale at yahoo.com
Mon Apr 20 10:48:20 EDT 2009


Hi,

I am trying to make connection to the JBoss JMX service, JBoss is running on
different machine than my host but in the same network.
Trying to use RMIAdapter to connect.
Follwoing is code I am trying:
			String providerUrl = "remote_host_name:1099";
			Properties p = new Properties();
		    p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
		    p.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
		    p.setProperty(Context.PROVIDER_URL, providerUrl);
		    p.setProperty(Context.SECURITY_PRINCIPAL, "admin");
		    p.setProperty(Context.SECURITY_CREDENTIALS, "admin");

		    InitialContext ic = new InitialContext(p);

			
		    MBeanServerConnection server = (MBeanServerConnection)
ic.lookup("jmx/invoker/RMIAdaptor");
			System.out.println("server "+server);

			ObjectName Oname = new ObjectName("jboss.system:type=ServerInfo");
			System.out.println("Host name: " + server.getAttribute(Oname,
"HostName"));


But I get follwoing exception:



server org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy at 82c01f
java.lang.SecurityException: Failed to authenticate principal=null,
securityDomain=WebSdkWebRealm
	at
org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:97)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at
org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
	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:585)
	at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
	at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
	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:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
	at java.lang.Thread.run(Thread.java:595)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
	at
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
	at
org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
	at
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
	at
org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:66)
	at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
	at
org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
	at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
	at $Proxy1.getAttribute(Unknown Source)
	at com.bmc.java.TestJbossConnection.connect(TestJbossConnection.java:38)
	at com.bmc.java.TestJbossConnection.main(TestJbossConnection.java:103)


If the JBoss server is running on my host machine, then this works. I get
the server information. 
Does any one know what am I missing here.
>From the exception stack it looks like I should pass the proper credentials.
But I haven't set any credentials for the JBoss server.

Please help.
Thanks in advance!


-- 
View this message in context: http://www.nabble.com/Remote-connection-to-JBoss-using-RMIAdapter-tp23138222p23138222.html
Sent from the JBoss - Dev mailing list archive at Nabble.com.




More information about the jboss-development mailing list