Forums Register Login

Queue Connection

+Pie Number of slices to send: Send
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)
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
hi,

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

rgds
+Pie Number of slices to send: Send
 

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
Oh the stink of it! Smell my tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1548 times.
Similar Threads
Unable to get JNDI lookup for JMS Topic Connection Factory
lookup exception while deploying application in websphere
exception in jndi configuration - spring framework
Unable to lookup JMS resources NotFound in WAS
Exception in JMS due to Configuration.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:46:46.