ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » object lookup error

Post new topic  Reply to topic
 object lookup error « View previous topic :: View next topic » 
Author Message
GLL0905
PostPosted: Tue Aug 20, 2002 1:03 pm    Post subject: object lookup error Reply with quote

Apprentice

Joined: 25 Jun 2001
Posts: 40
Location: gauteng, sa

I am getting the error:
javax.naming.NameNotFoundException: jms/JMSQCF when i try to run a jms program to do a put.
jms/JMSQCF is the qcf object i defined using jmsadmin tool and i can display it together with the queue.
I am using the file system to store the objects:

Context.INITIAL_CONTEXT_FACTORY= com.sun.jndi.fscontext.RefFSContextFactory
Context.PROVIDER_URL= file:/D:/MQSeries/java/jndi/

need help?

Thanks
Back to top
View user's profile Send private message Send e-mail
kolban
PostPosted: Tue Aug 20, 2002 1:55 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

What "exactly" do you have in your JMSConfig.admin file and what "exactly" do you have in your application for the context info.
Back to top
View user's profile Send private message
GLL0905
PostPosted: Tue Aug 20, 2002 11:11 pm    Post subject: Reply with quote

Apprentice

Joined: 25 Jun 2001
Posts: 40
Location: gauteng, sa

Hi, the contents of my config file and the code are:

jmsadmin.config:
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/D:/MQSeries/java/jndi/
SECURITY_AUTHENTICATION=none


code:
import java.util.*;
import javax.jms.*;
import javax.naming.*;

public class JMSQSender {

public static void main(String[] args) {

Queue queue = null;
QueueSender sender = null;
QueueSession session = null;
Context initContext = null;
TextMessage msgdata = null;
QueueConnection connection = null;
QueueConnectionFactory factory = null;

String putqName = "jms/JMSQ01";
String connectionName = "jms/JMSQCF";
String text = "JMSMQSeries test message...";

try {
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
environment.put
(Context.PROVIDER_URL, "file:/D:/MQSeries/java/jndi/");
initContext = new InitialContext(environment);
}
catch (NamingException e) {
System.out.println("jms context error: " + e);
System.exit(1);
}

// lookup connection factory and queue from jndi

try {
factory = (QueueConnectionFactory) initContext.lookup
(connectionName);
queue = (Queue) initContext.lookup(putqName);
}
catch (NamingException e) {
System.out.println("jndi lookup error: " + e);
System.exit(1);
}

// create connection
try {
connection = factory.createQueueConnection();
session = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
sender = session.createSender(queue);
msgdata = session.createTextMessage();
msgdata.setText(text);
sender.send(msgdata);
}
catch (JMSException e) {
System.out.println("jms error: " + e);
}
} }
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » object lookup error
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.