• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Queue Connection

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Ranga Reddy shreya
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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

rgds
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic