Author |
Message
|
khookguy |
Posted: Wed Apr 14, 2004 1:57 pm Post subject: Session.createProducer(null) throws MQJE001 Reason 2085 |
|
|
Novice
Joined: 14 Jan 2002 Posts: 13
|
Does MQ support the creation of a MessageProducer with a null destination? I'm getting the error specified in the subject - with reason 2085.
According to the JMS 1.1 Javadoc, I ought to be able to do this. Am I missing something?
Thanks,
Mark |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 15, 2004 5:11 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'm not 100% clear on what you are trying to do. Can you post the code fragment that throws the error? A 2085 is an unknown queue. As a guess, I'd suspect something with a model queue, but the code should clarify. |
|
Back to top |
|
 |
khookguy |
Posted: Thu Apr 15, 2004 6:57 am Post subject: sample code |
|
|
Novice
Joined: 14 Jan 2002 Posts: 13
|
Here is code that throws the exception. It is the statement ses.createProducer(null) that throws it.
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
h.put(Context.PROVIDER_URL,
"file://q:/book/jndi/EAI/NEWYORK");
h.put(Context.SECURITY_AUTHENTICATION, "none");
InitialContext jndiContext = new InitialContext(h);
ConnectionFactory cf = (ConnectionFactory)
jndiContext.lookup("conFac");
Connection con = cf.createConnection();
Session ses = con.createSession
(false, Session.AUTO_ACKNOWLEDGE);
Queue respQ =
(Queue) jndiContext.lookup("responses.newyork");
Queue reqQ =
(Queue) jndiContext.lookup("requests.london");
MessageProducer sender = ses.createProducer(null);
TextMessage msg = ses.createTextMessage("test");
sender.send(reqQ, msg); |
|
Back to top |
|
 |
gunter |
Posted: Thu Apr 15, 2004 7:40 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
I tried the line in my code and it works.
I havn't tested if it really works but havn't got any error.
Maybe your problem is Suns JMS. Look at this page http://docs.sun.com/source/817-3731-10/
Search 4821708 _________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
khookguy |
Posted: Thu Apr 15, 2004 7:56 am Post subject: |
|
|
Novice
Joined: 14 Jan 2002 Posts: 13
|
Interesting that it works for you ...
I'm not using the Sun JMS - just the file system implementation of JNDI at run time (and to configure JMSAdmin): com.sun.jndi.fscontext.RefFSContextFactory. I'm using WebSphere MQ 5.3 (CD06) in Windows 2000.
What is the equivalent IBM fscontext class that I could specify instead of com.sun.jndi.fscontext.RefFSContextFactory?
Any other ideas? Are there any model queues or other WMQ system infrastructure that might be used to implement a MessageProducer with an unspecified Destination (such as gets created from Session.createProducer(null)) ?
Thanks for your help,
Mark |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 15, 2004 7:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
khookguy wrote: |
What is the equivalent IBM fscontext class that I could specify instead of com.sun.jndi.fscontext.RefFSContextFactory? |
This is documented in the Using Java manual in the section on the JMSAdmin tool. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 15, 2004 10:12 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I thought com.sun.jndi.fscontext.RefFSContextFactory is what came with MQ and is what you were supposed to use for a file system context.
I just tried the same thing on my system, and it worked fine. I was able to put a message and then use the amqsbcg utility to confirm that it got put there. |
|
Back to top |
|
 |
gunter |
Posted: Thu Apr 15, 2004 10:16 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
This code works with null as parameter in createProducer.
Code: |
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.PROVIDER_URL, "ldap://paul/dc=jeschawitz,dc=de");
environment.put(Context.REFERRAL, "throw");
InitialDirContext ctx = new InitialDirContext( environment );
QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup( "cn=JMSTest.QCF,cn=jms" );
Queue qRequest = (Queue)ctx.lookup( "cn=JMSRequest.Q,cn=jms" );
QueueConnection connection = factory.createQueueConnection();
connection.start();
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
TextMessage msg = session.createTextMessage("test");
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MessageProducer sender = session.createProducer(null);
sender.send( qRequest, msg );
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
_________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 15, 2004 10:24 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Come to think of it, maybe you got bit by the case. The name that you lookup is "requests.london". You should have pointed this to a real queue via JMSAdmin. If you pointed it to "requests.london" and used runmqsc to define the queue, you might have created REQUESTS.LONDON. runmqsc wraps things to upper case if they aren't in quotes.
Double-check what the underlying queue is and make sure that it has been created to MQ. |
|
Back to top |
|
 |
khookguy |
Posted: Thu Apr 15, 2004 1:36 pm Post subject: Connection, not QueueConnection |
|
|
Novice
Joined: 14 Jan 2002 Posts: 13
|
bower5932 / gunther -
Your examples both use QueueConnection, rather than Connection. I ran bower5932's code and it worked. But when I changed the QueueConnection to a Connection, I get the same errors.
FYI, specifying CF to JMSAdmin, rather than QCF, results in a connection instance of type MQConnectionFactory rather than MQQueueConnectionFactory. I wonder if this is a bug in MQConnectionFactory?
-- Mark |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 15, 2004 1:55 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Well, the 2085 is caused by the SYSTEM.DEFAULT.BROKER.STREAM queue not being there. You can define it and you'll get past your error. When I display my CF, it definitely has a "look and feel" to it of a TCF rather than a QCF. I've always explicitly picked one or the other, so I'm at a loss to explain the behavior that you are seeing. I'll have to think about it.
In the mean time, define the queue.  |
|
Back to top |
|
 |
khookguy |
Posted: Thu Apr 15, 2004 2:18 pm Post subject: |
|
|
Novice
Joined: 14 Jan 2002 Posts: 13
|
IMHO, this is a bug. At a minimum, one should get an exception telling you that you can't use CF without installing pub/sub features.
Thanks for helping me sort this out!
-- Mark |
|
Back to top |
|
 |
|