ConnectionFactory not bound error
srjg75 Apr 15, 2006 7:06 PM1) I have been trying to use a standalone JMS sender.
import javax.jms.*;
import javax.naming.*;
public class MessageToQueue
{
 public static void main(String[] args)
 throws NamingException,JMSException
 {
 InitialContext ctx;
 QueueConnectionFactory cf;
 QueueConnection connection;
 QueueSession session;
 Queue destination;
 QueueSender sender;
 TextMessage message;
 ctx = new InitialContext();
 cf = (QueueConnectionFactory)ctx.lookup("java:/QueueConnectionFactory");
 System.out.println("1");
 destination = (Queue)ctx.lookup("queue/testQueue");
 System.out.println("2");
 connection = cf.createQueueConnection();
 System.out.println("3");
 session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
 System.out.println("4");
 sender = session.createSender(destination);
 System.out.println("5");
 message = session.createTextMessage();
 System.out.println("6");
 message.setText("Hello World!");
 System.out.println("Sending Message.");
 sender.send(message);
 connection.close();
 System.out.println("Done.");
 }
}
2) I have the following in the JNDI properties in C:\jboss-4.0.3SP1\server\default\conf:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099
3) I have the following in the jboss-service.xml in
C:\jboss-4.0.3SP1\server\default\conf:
 <!-- The listening port for the bootstrap JNP service. Set this to -1
 to run the NamingService without the JNP invoker listening port.
 -->
 1099
4) JBOSS server is on port 8080. Started the server
5) Executed this in command "java MessageSender"
Got this error:
Exception in thread "main" javax.naming.NameNotFoundException: QueueConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at java.naming.InitialContext.lookup(InitialContext.java:351)
at MessageToQueue.main(MessageToQueue.java:17)
Could you let me know what is the exact problem? Thanks
Regards
Shriram
 
    