jms activemq ;sending message to the already existing remote queue

narcist527
narcist527 used Ask the Experts™
on
I am trying to send a message to already existing queue and using the below code and not working. I found this on internet and playing around this. here he is creating queue . But I want to send a message without creating queue. it was throwing an error " javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format."

any help is highly appreciated

QueueConnectionFactory connectionFactory=new ActiveMQConnectionFactory("vm://test");
  QueueConnection queueConnection=null;
  QueueSession session=null;
  QueueSender sender=null;
  Queue queue=null;
  TextMessage message=null;
  try {
    queueConnection=connectionFactory.createQueueConnection();
    session=queueConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
    queue=session.createQueue(TEST_QUEUE_NAME);
    sender=session.createSender(queue);
    sender.setDeliveryMode(DeliveryMode.PERSISTENT);
    message=session.createTextMessage(String.valueOf(i));
    sender.send(message);
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mccarlIT Business Systems Analyst / Software Developer
Top Expert 2015

Commented:
Can you send the full code that you used? This is so we can run it and check for ourselves.

Can you tell us what version of ActiveMQ you are using?

Can you post the full exception message AND stack trace that you get?

Author

Commented:
@mccarl,
first off thanks for reply.

as a automation testing engineer, I am working on automating this process. so I was provided with jndi url, connection factory string , queues and topics. I have been trying to send the message to already existing queues. These are remote queues. I replaced the parameters in that code snippet with the appropriate values and it is throwing the below error. appreciate your time and help

javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format.
      at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
      at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1206)
      at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1289)
      at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:295)
      at org.apache.activemq.ActiveMQConnection.createQueueSession(ActiveMQConnection.java:1143)
      at com.swa.jmsmessages.SendingJmsMsg.main(SendingJmsMsg.java:82)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.io.IOException: Wire format negotiation timeout: peer did not send his wire format.
      at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:94)
      at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
      at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:74)
      at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:79)
      at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1195)
      ... 9 more
IT Business Systems Analyst / Software Developer
Top Expert 2015
Commented:
so I was provided with jndi url, connection factory string , queues and topics
Based off your other questions, can I assume that these details pertain to the remote Tibco JMS broker?

I replaced the parameters in that code snippet with the appropriate values
And if my above assumption is correct, are you saying that you replaced the parameters in the above (ActiveMQ specific) code with these (Tibco specific) parameters that you were given?


If the above two assumptions are correct, then NO it's never going to work. You can't use ActiveMQ client to connect to a Tibco broker. Yes they both implement the JMS standard but JMS is a bit different to what you may be expecting... it is an API standard only not a wire/protocol standard.

You need (as you asked in a different question) the Tibco client jars as they know how to talk Tibco's protocol to the Tibco broker. Nothing else will work other than that. So, you need to ask for those jar files from whoever gave you the broker/queue details, or from whoever administers the broker/server.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial