Yes, but how MyQueue is registered in JBoss?  It is necessary to
raise again the server for it works?


Thank you very much!

        Valentin.

-----Mensaje original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]En nombre de Taylor,
Richard
Enviado el: lunes 14 de mayo de 2001 16:15
Para: '[EMAIL PROTECTED]'
Asunto: RE: [JBoss-user] Registry of Queue in JBoss/JMS


If your queue name is MyQueue in JBoss, you have to look it up as
queue/MyQueue.  Similarly MyTopic is topic/MyTopic.

Richard.

-----Original Message-----
From: Valentin Encinas [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 14, 2001 2:52 PM
To: Jboss-User
Subject: [JBoss-user] Registry of Queue in JBoss/JMS


Hello again!

Now I have the following error in JMS:

Queue name is MyQueue
JNDI lookup failed: javax.naming.NameNotFoundException: MyQueue not bound

The code of the program is simple and is the following one:

import java.util.Properties;
import javax.jms.*;
import javax.naming.*;

public class SimpleQueueSender {
    public static void main(String[] args) {
        String                  queueName = null;
        Context                 jndiContext = null;
        QueueConnectionFactory  queueConnectionFactory = null;
        QueueConnection         queueConnection = null;
        QueueSession            queueSession = null;
        Queue                   queue = null;
        QueueSender             queueSender = null;
        TextMessage             message = null;
        final int               NUM_MSGS;
        final String    MSG_TEXT = new String("Here is a message");

        System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
        System.setProperty("java.naming.provider.url", "localhost:1099");

        queueName = new String("A");
        System.out.println("Queue name is " + queueName);
        NUM_MSGS = 1;

        try {
           jndiContext = new InitialContext();
        } catch (NamingException e) {
            System.out.println("Could not create JNDI " +
                "context: " + e.toString());
            System.exit(1);
        }

        try {
            queueConnectionFactory = (QueueConnectionFactory)
                jndiContext.lookup("QueueConnectionFactory");
         queue = (Queue) jndiContext.lookup(queueName); // Here it is where
it gives the error because it it does not find

        } catch (NamingException e) {
            System.out.println("JNDI lookup failed: " +
                e.toString());
            System.exit(1);
        }

        try {
            queueConnection =
                queueConnectionFactory.createQueueConnection();
            queueSession =
                queueConnection.createQueueSession(false,
                    Session.AUTO_ACKNOWLEDGE);
            queueSender = queueSession.createSender(queue);
            message = queueSession.createTextMessage();
            for (int i = 0; i < NUM_MSGS; i++) {
                message.setText(MSG_TEXT + " " + (i + 1));
                System.out.println("Sending message: " +
                    message.getText());
                queueSender.send(message);
            }

            queueSender.send(queueSession.createMessage());
        } catch (JMSException e) {
            System.out.println("Exception occurred: " +
                e.toString());
        } finally {
            if (queueConnection != null) {
                try {
                    queueConnection.close();
                } catch (JMSException e) {}
            }
        }
    }
}

I believe that the problem is in which not this registered MyQueue. Where it
must make this in JBoss and like?


Thank you very much!




**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to