[jboss-user] [JNDI/Naming/Network] - Connection Refused looking up jmx/rmi/RMIAdaptor on JBoss_4_

harleybl do-not-reply at jboss.com
Fri Jun 22 11:56:10 EDT 2007


I am having trouble looking up the jmx/rmi/RMIAdaptor within JBoss 4.2.0 GA GA. I looked all over site and did not find an answer. This did work with JBoss 4.0.3SP1 and the same configuration which makes me scratch my head.

I have the following policy file and -Djava.security.policy variable pointing to this file in my run.bat script.

grant {
  |     permission java.security.AllPermission;
  |     permission java.util.PropertyPermission "*", "read,write";
  |     permission java.net.SocketPermission "*", "connect,accept,resolve,listen";
  | };

This following simple example from the Wiki fails with the exception to follow:

public static void main( String args[] )
  |             throws Exception
  |     {
  |         MBeanServerConnection server;
  |         Properties prop = new Properties();
  |         prop.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |         String serverHost = InetAddress.getLocalHost().getHostName();
  |         prop.put(Context.PROVIDER_URL, serverHost);        
  |         InitialContext initialContext = new InitialContext( prop );
  | 
  |         server = ( MBeanServerConnection ) initialContext.lookup( "jmx/rmi/RMIAdaptor" );
  |         ObjectName on = new ObjectName( "jboss.system:type=Server" );
  |         Object ver = server.getAttribute( on, "Version" );
  |         System.out.println( "Version " + ver );
  |     }
  | 

Here is the exception of Connection Refused...

Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: ST-BLUMENXP and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server ST-BLUMENXP:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server ST-BLUMENXP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
  | 	at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
  | 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
  | 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
  | 	at javax.naming.InitialContext.lookup(InitialContext.java:351)
  | 	at PrintVersion.main(PrintVersion.java:29)
  | Caused by: javax.naming.CommunicationException: Failed to connect to server ST-BLUMENXP:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server ST-BLUMENXP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
  | 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
  | 	at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
  | 	... 4 more
  | Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server ST-BLUMENXP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
  | 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
  | 	... 5 more
  | Caused by: java.net.ConnectException: Connection refused: connect
  | 	at java.net.PlainSocketImpl.socketConnect(Native Method)
  | 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  | 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  | 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  | 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
  | 	at java.net.Socket.connect(Socket.java:519)
  | 	at java.net.Socket.connect(Socket.java:469)
  | 	at java.net.Socket.<init>(Socket.java:366)
  | 	at java.net.Socket.<init>(Socket.java:266)
  | 	at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
  | 	at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
  | 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
  | 	... 5 more
  | 
I took out the jboss code and stepped through in the debugger and it is failing to connect to the socket, almost like it's not listening. However I can telnet to 1099 on my local machine and get a connection, so that is why I am confused about the Connection refused exception. 

At first I thought it was a security problem but it's not even getting that far. 

Any help would be most appriciated.

Thanks,
Harley

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

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



More information about the jboss-user mailing list