Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Queue Connection Factory in WAS

 
Venkat Ammisetty
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai
I need your help in implementing JMS QueueConnectionFactory in WAS 4.0
The following is the part of code to implement JMS with QueueConnectionFactory.I am pasting code below.My actual application is to put all e-mails list in Queue and send them when ever my mail server is free.
Please let me know why I am getting this exception and educate me in this regard if I am wrong in any QueueConnection Names.
But i am getting the following Exception
javax.naming.NameNotFoundException: QueueConnectionFactory
Partial CODE:
<%@ page language="java" <br /> import="javax.naming.*,javax.jms.*,java.util.* " %>
<%<br /> String JNDI_FACTORY="com.ibm.websphere.naming.WsnInitialContextFactory";<br /> String JMS_FACTORY="QueueConnectionFactory";<br /> String queueName="A";<br /> try{<br /> QueueConnectionFactory qconFactory;<br /> QueueConnection qcon=null;<br /> QueueSession qsession;<br /> QueueSender qsender;<br /> Queue queue=null;<br /> TextMessage msg;<br /> ObjectMessage omsg;<br /> System.out.println("hello");<br /> out.println("before hash table");<br /> Hashtable env = new Hashtable();<br /> env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);<br /> env.put(Context.PROVIDER_URL, "iiop://localhost:900");<br /> InitialContext ic=new InitialContext(env);<br /> out.println("before jms lookup");<br /> qconFactory = (QueueConnectionFactory) ic.lookup(JMS_FACTORY);<br /> qcon=null;<br /> qcon = qconFactory.createQueueConnection();<br /> out.println("just for fun");<br /> qsession = qcon.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);<br /> out.println("jndi lookup is successfull");<br /> <br /> <br /> queue = (Queue) ic.lookup(queueName);<br /> <br /> qsender = qsession.createSender(queue);<br /> omsg = qsession.createObjectMessage();<br /> qcon.start();<br /> Vector v=new Vector();<br /> v.addElement("venkat");<br /> omsg.setObject(v);<br /> qsender.send(omsg);<br /> qsender.close();<br /> qsession.close();<br /> qcon.close();<br /> System.out.println("vector is put in the queue");<br /> } catch (Exception ne) {<br /> <br /> out.println("wrong queue is"+ne);<br /> }<br /> <br /> %>

Thank's
Venkat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic