|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQ-JMS-WebSphere |
« View previous topic :: View next topic » |
Author |
Message
|
Itchy |
Posted: Sun Mar 16, 2003 9:21 pm Post subject: MQ-JMS-WebSphere |
|
|
Newbie
Joined: 16 Mar 2003 Posts: 8
|
hi friends,
I am trying to use MQSeries v5.2 - MA88 - WAS v4.0.3 for JMS applications.
I am unable to register QueueConnectionFactory using JMSAdmin or ivtSetup with JNDI. Without JNDI, everything runs fine.
For JNDI I tried specifying following in JMSAdmin.config -
INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory;
Or
INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory;
PROVIDER_URL=iiop://localhost/900
Or
PROVIDER_URL=iiop://localhost/
Also, If I use file system JNDI, it works fine, so looks like I am not specifying either INITIAL_CONTEXT_FACTORY or PROVIDER_URL for WebSphere App Server correctly.
Please let me know what do I specify.
Thanks in advance & regards. |
|
Back to top |
|
 |
vennela |
Posted: Mon Mar 17, 2003 6:25 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Check your CLASSPATH and make sure your WAS is running.
While WAS is do this
IVTRun -url iiop://localhost:900 -icf com.ibm.websphere.naming.WsnInitialContextFactory -t
(this will help you figure out the classpath errors).
Also I don't think "iiop://localhost/900 " works. There should be a colon( between hostname and port number.
-------
Venny |
|
Back to top |
|
 |
Itchy |
Posted: Tue Mar 18, 2003 7:23 pm Post subject: |
|
|
Newbie
Joined: 16 Mar 2003 Posts: 8
|
hi,
Thanks for the reply. I found out what was wrong.
I was putting INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory;
When I removed the semicolon it started working with PROVIDER_URL=iiop://localhost/
But now I am getting some other error - javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for ' '
I have a defualt queue manager running and this is my code -
import javax.servlet.*;
import javax.servlet.http.*;
import javax.jms.*;
import com.ibm.mq.jms.*;
import javax.naming.*;
import java.util.Hashtable;
public
class SendMQJMSMessage extends HttpServlet {
public final String JNDI_FACTORY="com.ibm.ejs.ns.jndi.CNInitialContextFactory";
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException
{
try{
InitialContext ctx = new InitialContext();
Context env = (Context)ctx.lookup("java:comp/env");
QueueConnectionFactory qcf = (QueueConnectionFactory)env.lookup("myQCF");
QueueConnection qc = qcf.createQueueConnection();
QueueSession session = qc.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
Queue q = (Queue)ctx.lookup("myQ");
QueueSender sender = session.createSender(q);
Message message = (Message)session.createTextMessage("Test Message 11212");
sender.send(message);
}catch(NamingException ne){
ne.printStackTrace();
}catch(JMSException jmse){
jmse.printStackTrace();
}
}
public InitialContext getInitialContext(String str) throws NamingException{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
env.put(Context.PROVIDER_URL, str);
return new InitialContext(env);
}
}
I think error is coming when I am creating Sender for the queue.
Please let me know what I am doing wrong...
regards. |
|
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
|
|
|
|