aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Queue Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Queue Connection" Watch "Queue Connection" New topic
Author

Queue Connection

Ranga Reddy shreya
Ranch Hand

Joined: Oct 20, 2004
Posts: 30
HI All,
I am trying to connect to websphere jms provider...
and i am getting this error what to do.....
thanks...
Arpitha.
javax.naming.NameNotFoundException: Context: VAIO-XP/nodes/VAIO-XP/servers/server1, name: jms/arpitha_qcf : First component in name arpitha_qcf not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:84)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1067)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at JMSClient.send(JMSClient.java:26)
at JMSClient.main(JMSClient.java:10)


Enjoy life .
Ranga Reddy shreya
Ranch Hand

Joined: Oct 20, 2004
Posts: 30
hi ,
I am using an exampel program to connect the queue
this is my program.. and i am getting the above error
import javax.jms.*;
import javax.naming.*;

public class JMSClient {

public static void main(String[] args) {

new JMSClient().send();
}

public void send() {


try {
//Prompt for JNDI names

String factoryName = "jms/arpitha_qcf ";

String queueName = "jms/arpitha_qd";

//Look up administered objects
InitialContext initContext = new InitialContext();
QueueConnectionFactory factory =
(QueueConnectionFactory) initContext.lookup(factoryName);
Queue queue = (Queue) initContext.lookup(queueName);
initContext.close();

//Create JMS objects
QueueConnection connection = factory.createQueueConnection();
QueueSession session =
connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);

//Send messages
String messageText = "Test message from Shreya to Divya";


TextMessage message = session.createTextMessage(messageText);
sender.send(message);


//Exit
System.out.println("Exiting...");

connection.close();
System.out.println("Goodbye!");

} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
thanks
ranga
siva kumar
Ranch Hand

Joined: Sep 03, 2004
Posts: 86
hi,

make sure thar mqjms.jar,mq.jar and mqbind.jar are in your classpath

rgds
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Ranga Reddy shreya:
hi ,
I am using an exampel program to connect the queue
this is my program.. and i am getting the above error
import javax.jms.*;
import javax.naming.*;

public class JMSClient {

public static void main(String[] args) {

new JMSClient().send();
}

public void send() {


try {
//Prompt for JNDI names

String factoryName = "jms/arpitha_qcf ";

String queueName = "jms/arpitha_qd";

//Look up administered objects
InitialContext initContext = new InitialContext();
QueueConnectionFactory factory =
(QueueConnectionFactory) initContext.lookup(factoryName);
Queue queue = (Queue) initContext.lookup(queueName);
initContext.close();

//Create JMS objects
QueueConnection connection = factory.createQueueConnection();
QueueSession session =
connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);

//Send messages
String messageText = "Test message from Shreya to Divya";


TextMessage message = session.createTextMessage(messageText);
sender.send(message);


//Exit
System.out.println("Exiting...");

connection.close();
System.out.println("Goodbye!");

} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
thanks
ranga


Hi,

As the client program is outside your application server context, you have to provide the appserver context and look up url in the initialContext object.

By Default, new InitialContext() method will be used for local jndi lookup.
And for external jndi lookup you have to provide the initial context factory and provider url.

Regards,
M.S.Raman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Queue Connection