Hi.

I am having problems with run a client for my mbean.
I am studing the tutorial for building j2ee applications using jboss and eclipse. In 
the chapter 7 the client of the mbean throws javax.naming.NameNotFoundException: 
ConnectionFactory not bound.

What should I do?

My client code:

/*
 * Created on 27/09/2004
 */
package au.com.tusc.mdb;

import java.util.Hashtable;

import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 * @author Li
 *
 */
public class RequestMDBClient
{
        private InitialContext getContext() throws NamingException
        {
                Hashtable props = new Hashtable();
                props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
                        "org.jnp.interfaces.NamingContextFactory");
                props.put(InitialContext.PROVIDER_URL,"jnp://127.0.0.1:1099");
                
                InitialContext initialContext = new InitialContext(props);
                return initialContext;
        }
        
        public void testMDBBean()
        {
                RequestItems ri = new RequestItems("RUSTY","PASSWD","14",30);
                try
                {
                        System.out.println("Looking up the factory");
                        InitialContext ctx = getContext();
                        QueueConnectionFactory factory = (QueueConnectionFactory) 
ctx.lookup("ConnectionFactory");
                        System.out.println("Looking up the queue");
                        Queue queue = (Queue)ctx.lookup("queue/MdbQueue");
                        System.out.println("Creating the connection now...");
                        QueueConnection connection = factory.createQueueConnection();
                        System.out.println("Create the session now...");
                        QueueSession session = connection.createQueueSession(true, 1);
                        System.out.println("Creating the sender now...");
                        QueueSender sender = session.createSender(queue);
                        ObjectMessage message = session.createObjectMessage();
                        System.out.println("Setting the object in message now...");
                        message.setObject(ri);
                        System.out.println("Sending the message");
                        sender.send(message);
                        System.out.println("Shuting down");
                        session.commit();
                        session.close();
                        connection.close();
                        System.out.println("Finished");
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }
        }
        
        public static void main(String[] args)
        {
                RequestMDBClient test = new RequestMDBClient();
                test.testMDBBean();
        }
}


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

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


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to