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 » jndi problem

Post new topic  Reply to topic Goto page Previous  1, 2
 jndi problem « View previous topic :: View next topic » 
Author Message
fjb_saper
PostPosted: Tue Feb 26, 2008 3:43 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20763
Location: LI,NY

jefflowrey wrote:
In fact this #2 is a JMS FAQ.

You need to start the receiver.


You need to start the receiver by starting the connection.

Quote:
MQQueue ioQueue=(MQQueue)session.createQueue( "Q2" );

If you want to use this form to create the destination at least use the URI form and suppress the RFH header you really need to do it like this:
Code:
 MQQueue ioQueue=(MQQueue)session.createQueue( "queue:///Q2?targetClient=1" );

You can read all about it in the using java manual.
You can set the attributes using JNDI and retrieve the destination. You can then print the destination to see the URI form...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
pvsp
PostPosted: Sat Mar 01, 2008 12:39 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Feb 2008
Posts: 36
Location: Warsaw, PL

fjb_saper wrote:
jefflowrey wrote:
In fact this #2 is a JMS FAQ.

You need to start the receiver.


You need to start the receiver by starting the connection.

Quote:
MQQueue ioQueue=(MQQueue)session.createQueue( "Q2" );

If you want to use this form to create the destination at least use the URI form and suppress the RFH header you really need to do it like this:
Code:
 MQQueue ioQueue=(MQQueue)session.createQueue( "queue:///Q2?targetClient=1" );

You can read all about it in the using java manual.
You can set the attributes using JNDI and retrieve the destination. You can then print the destination to see the URI form...

Enjoy

I really don't know what is wrong, i did as you said and I have still the same problem - I can put a message but I can't get. This is my code but I think I'm doing sth wrong out of code.

Code:

         Context context = new InitialContext(env);
         
         QueueConnectionFactory factory=(QueueConnectionFactory)context.lookup("QM1");
         
         

         QueueConnection connection = factory.createQueueConnection();
         
         QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         

         //Queue ioQueue=session.createQueue( "Q1" );
         Queue ioQueue=(Queue)session.createQueue( "queue:///Q1?targetClient=1" );
   /*
         QueueSender queueSender = session.createSender(ioQueue);
         
         
         TextMessage outMessage = session.createTextMessage();
         outMessage.setText("test msg 3");
         
         queueSender.send(outMessage);
   */
         

         QueueReceiver queueReceiver = session.createReceiver(ioQueue);
         TextMessage inMessage = (TextMessage)queueReceiver.receive(1000);
         System.out.println(inMessage.getText());
Back to top
View user's profile Send private message
pvsp
PostPosted: Sat Mar 01, 2008 1:09 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Feb 2008
Posts: 36
Location: Warsaw, PL

OK, I found my mistake
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » jndi problem
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.