Hi All,

I am getting error in running example from following URL.

Example--------------------------------------------

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package jmsdemo;

import javax.jms.ConnectionFactory;
import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.MessageProducer;
import javax.jms.MessageConsumer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.Message;
import javax.jms.TextMessage;
//Import the classes to use JNDI.
import javax.naming.*;
import java.util.*;

public class HelloWorldMessage {

/**
* Main method.
*
* @param args not used
*
*/
public static void main(String[] args) {

try {

ConnectionFactory myConnFactory;
Queue myQueue;

/*
* The following code uses the JNDI File System Service Provider
* to lookup() Administered Objects that were stored in the
* Administration Console Tutorial in the Administrator's Guide
*
* The following code (in this comment block replaces the
* statements in Steps 2 and 5 of this example.
*
****
String MYCF_LOOKUP_NAME = "MyConnectionFactory";
String MYQUEUE_LOOKUP_NAME = "MyQueue";

Hashtable env;
Context ctx = null;

env = new Hashtable();

// Store the environment variable that tell JNDI which initial context
// to use and where to find the provider.

// For use with the File System JNDI Service Provider
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
// On Unix, use file:///tmp instead of file:///C:/Temp
env.put(Context.PROVIDER_URL, "file:///C:/Temp");

// Create the initial context.
ctx = new InitialContext(env);

// Lookup my connection factory from the admin object store.
// The name used here here must match the lookup name
// used when the admin object was stored.
myConnFactory = (javax.jms.ConnectionFactory) ctx.lookup(MYCF_LOOKUP_NAME);

// Lookup my queue from the admin object store.
// The name I search for here must match the lookup name used when
// the admin object was stored.
myQueue = (javax.jms.Queue)ctx.lookup(MYQUEUE_LOOKUP_NAME);
****
*
*/

//Step 2:
//Instantiate a Sun Java(tm) System Message Queue ConnectionFactory
//administered object.
//This statement can be eliminated if the JNDI code above is used.
myConnFactory = new com.sun.messaging.ConnectionFactory();


//Step 3:
//Create a connection to the Sun Java(tm) System Message Queue Message
//Service.
Connection myConn = myConnFactory.createConnection();


//Step 4:
//Create a session within the connection.
Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);


//Step 5:
//Instantiate a Sun Java(tm) System Message Queue Destination
//administered object.
//This statement can be eliminated if the JNDI code above is used.
myQueue = new com.sun.messaging.Queue("world");


//Step 6:
//Create a message producer.
MessageProducer myMsgProducer = mySess.createProducer(myQueue);


//Step 7:
//Create and send a message to the queue.
TextMessage myTextMsg = mySess.createTextMessage();
myTextMsg.setText("Hello World");
System.out.println("Sending Message: " + myTextMsg.getText());
myMsgProducer.send(myTextMsg);


//Step 8:
//Create a message consumer.
MessageConsumer myMsgConsumer = mySess.createConsumer(myQueue);


//Step 9:
//Start the Connection created in step 3.
myConn.start();


//Step 10:
//Receive a message from the queue.
Message msg = myMsgConsumer.receive();


//Step 11:
//Retreive the contents of the message.
if (msg instanceof TextMessage) {
TextMessage txtMsg = (TextMessage) msg;
System.out.println("Read Message: " + txtMsg.getText());
}


//Step 12:
//Close the session and connection resources.
mySess.close();
myConn.close();

} catch (Exception jmse) {
System.out.println("Exception occurred : " + jmse.toString());
jmse.printStackTrace();
}
}
}


Error--------------------------------

Exception occurred : com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused: connect
com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused: connect
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.g etJMSConnectException(ExceptionHandler.java:233)
at com.sun.messaging.jmq.jmsclient.ExceptionHandler.h andleConnectException(ExceptionHandler.java:180)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.r eadBrokerPorts(PortMapperClient.java:176)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.i nit(PortMapperClient.java:101)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.< init>(PortMapperClient.java:54)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPCo nnectionHandler.<init>(TCPConnectionHandler.java:6 1)
at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPSt reamHandler.openConnection(TCPStreamHandler.java:1 02)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiato r.createConnectionOld(ConnectionInitiator.java:281 )
at com.sun.messaging.jmq.jmsclient.ConnectionInitiato r.createConnection(ConnectionInitiator.java:107)
at com.sun.messaging.jmq.jmsclient.ConnectionInitiato r.createConnection(ConnectionInitiator.java:92)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.in it(ProtocolHandler.java:613)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.<i nit>(ProtocolHandler.java:1194)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.ope nConnection(ConnectionImpl.java:1894)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.ini t(ConnectionImpl.java:712)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.<in it>(ConnectionImpl.java:293)
at com.sun.messaging.jmq.jmsclient.UnifiedConnectionI mpl.<init>(UnifiedConnectionImpl.java:33)
at com.sun.messaging.BasicConnectionFactory.createCon nection(BasicConnectionFactory.java:110)
at com.sun.messaging.BasicConnectionFactory.createCon nection(BasicConnectionFactory.java:95)
at jmsdemo.HelloWorldMessage.main(HelloWorldMessage.j ava:87)
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(PlainSoc ketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava: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:180)
at com.sun.messaging.jmq.jmsclient.PortMapperClient.r eadBrokerPorts(PortMapperClient.java:156)
... 16 more
--------------------------------------------------------

Could you please help me to resolve this error?

Thanks,
Regards,
Ashwin.