File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jms test

 
John Gregory
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to run the following code:

ic = new InitialContext(env);
QueueConnectionFactory qcf = (QueueConnectionFactory)
ic.lookup("ConnectionFactory");
conn = qcf.createQueueConnection();
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

sQue = (Queue) ic.lookup("queue/JJGQue"); // sQue is a Queue
qSender = session.createSender(sQue); //QueueSender
rQue = (Queue) ic.lookup("queue/MSGQ"); // rQue is a Queue

I'm getting the following error:

/development/MsgTest/src/test/main/Main.java:45: createSender(javax.jms.Queue) in javax.jms.QueueSession cannot be applied to (java.util.Queue)
qSender = session.createSender(sQue);
/development/MsgTest/src/test/main/Main.java:48: cannot find symbol
symbol : method createReceiver(java.util.Queue)
location: interface javax.jms.QueueSession
qRcver = session.createReceiver(rQue);

Can anyone tell me why? I didn't think I was doing anything out of
the ordinary.

Thanks,

John
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Gregory:
/development/MsgTest/src/test/main/Main.java:45: createSender(javax.jms.Queue) in javax.jms.QueueSession cannot be applied to (java.util.Queue)
qSender = session.createSender(sQue);
/development/MsgTest/src/test/main/Main.java:48: cannot find symbol
symbol : method createReceiver(java.util.Queue)
location: interface javax.jms.QueueSession
qRcver = session.createReceiver(rQue);



It's just a case of importing the wrong package. For the variables rQue and sQue you probably have imported java.util.Queue instead of javax.jms.Queue.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic