Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

error: ConnectionFactory not bound

843830Mar 11 2005 — edited Dec 7 2006
Hi,

I have created a method in session bean to send message. below is the code of my method

public void sendMessage() throws NamingException,JMSException{

QueueConnectionFactory cf;
QueueConnection connection;
QueueSession session;
Queue destination;
QueueSender sender;
TextMessage message;

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL,
"localhost:1099");
Context ctx = new InitialContext(env);


//ctx = new InitialContext();
cf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
destination = (Queue)ctx.lookup("queue/testQueue");

connection = cf.createQueueConnection();
session = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
sender = session.createSender(destination);
message = session.createTextMessage();
message.setText("Hello World1!");

System.out.println("Sending Message.");
sender.send(message);

connection.close();
System.out.println("Done.");
}

I am getting the following error in the browser

javax.naming.NameNotFoundException: ConnectionFactory not bound

Can anyone tell me why this error is coming
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2007
Added on Mar 11 2005
6 comments
2,117 views