javax.naming.CommunicationException: Connection refused

hi,

I am trying to get the jndi context using the following program with oracle application server which is running in remote system.

import javax.naming.InitialContext;

import java.util.Hashtable;

import javax.jms.QueueConnectionFactory;

import javax.jms.QueueConnection;

import javax.jms.QueueSession;

import javax.jms.QueueSender;

import javax.jms.TextMessage;

import javax.jms.Queue;

public class MessageSender

{

public static void main(String[] args)

{

if(args.length != 3) {

System.out.println("Try as java <queue-connection-factory-name> <queue-name> <message>");

}

String queueConnFactory = args[0];

String queueName = args[1];

String message = args[2];

InitialContext jndiContext = null;

QueueConnection qcon = null;

try

{

Hashtable props = new Hashtable();

props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");

props.put(InitialContext.PROVIDER_URL, "ormi://inauser30:23791");

jndiContext = new InitialContext(props);

QueueConnectionFactory qcf = (QueueConnectionFactory) jndiContext.lookup(queueConnFactory);

Queue queue = (Queue) jndiContext.lookup(queueName);

qcon = qcf.createQueueConnection();

QueueSession qses = qcon.createQueueSession(false, 0);

QueueSender qsen = qses.createSender(queue);

TextMessage msg = qses.createTextMessage();

msg.setText(message);

qsen.send(msg);

}

catch (Exception ex)

{

ex.printStackTrace();

} finally {

try

{

qcon.close();

}

catch (Exception ex)

{

ex.printStackTrace();

}

}

}

}

But its throwing the exception as:

javax.naming.CommunicationException: Connection refused: connect [Root exception

is java.net.ConnectException: Connection refused: connect]

at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:258)

at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java

:50)

at javax.naming.InitialContext.lookup(Unknown Source)

at com.inatech.jms.MessageSender.main(MessageSender.java:34)

Caused by: java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(Unknown Source)

at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at com.evermind.server.rmi.RMIClientConnection.createSocket(RMIClientCon

nection.java:635)

at oracle.oc4j.rmi.ClientSocketRmiTransport.createNetworkConnection(Clie

ntSocketRmiTransport.java:58)

at oracle.oc4j.rmi.ClientRmiTransport.connectToServer(ClientRmiTransport

.java:78)

at oracle.oc4j.rmi.ClientSocketRmiTransport.connectToServer(ClientSocket

RmiTransport.java:68)

at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnecti

on.java:600)

at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnectio

n.java:130)

at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:249)

please mail me the solution for the same.

[3545 byte] By [mjpka] at [2007-10-3 4:45:50]
# 1
The RMI Registry is not running at //inauser30:23791.
ejpa at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 2
Please post the solution in forum. Got the same problem
Zeleona at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 3
> The RMI Registry is not running at //inauser30:23791.That's the problem. The solution is to fix this problem.
ejpa at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 4
The problem is that I could not find the real path. But I migrated to JDeveloper with OC4J embedded and that works fine.It would be nice with a guide to find the real path though...
Zeleona at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 5
What do you mean by 'the real path?'
ejpa at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 6
How do i find out where the RMI registry is located?
Zeleona at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 7
There is only one possible place to locate it, in the same host as the JVM which exports the RMI server(s). But it won't be located there unless you start it yourself.
ejpa at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...
# 8
Thanks. Then I'll do some research on the RMI.
Zeleona at 2007-7-14 22:50:11 > top of Java-index,Core,Core APIs...