|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
object lookup error |
« View previous topic :: View next topic » |
Author |
Message
|
GLL0905 |
Posted: Tue Aug 20, 2002 1:03 pm Post subject: object lookup error |
|
|
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 |
|
 |
kolban |
Posted: Tue Aug 20, 2002 1:55 pm Post subject: |
|
|
 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 |
|
 |
GLL0905 |
Posted: Tue Aug 20, 2002 11:11 pm Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|