0 Replies Latest reply on Apr 21, 2015 5:43 AM by Alessandro Gelormini

    Hornetq error when sending messages to temporary queue

    Alessandro Gelormini Newbie


      I have ear backend on eap 6.1 and some clients that connect to it. When client connects, it creates a temporary queue and passes it to server as Queue in order to save it and link with that client. after that when server has to send some message to only one particular client it can retrieve the previous queue and send messages. Note that i'm migrating from jboss 4.2.3 and this kind of management is working perfectly.

      Now I have some problem because when server retrieve the queue and send the message it throws  javax.jms.InvalidDestinationException: Not a HornetQ Destination:HornetQTemporaryQueue[dd7136ee-412e-48df-8b74-7598400745d5].

      Client creates the queue in this way and i don't get any error


      private void topicSubscribe() {
        try {
             Properties props = System.getProperties();
             Context iniCtx = com.lisspa.serverAccess.utilty.Utility
             Object tmp = iniCtx.lookup("jms/RemoteConnectionFactory");
             QueueConnectionFactory tcf = (QueueConnectionFactory) tmp;
             conn = tcf.createQueueConnection(props.getProperty("user.name"),"password01!");
             session = conn.createQueueSession(false,
             tmpQueue = session.createTemporaryQueue();
             receiver = session.createReceiver(tmpQueue);
        } catch (NamingException ne) {
             throw new RuntimeException(ne);
        } catch (JMSException jmse) {
             throw new RuntimeException(jmse);



      Server side when it's the time to send message it does call send function passing the queue created by client previously and the message to send..


      private LogSender() {
        Context iniCtx;
        try {
             iniCtx = Utility.getContext();
             Object tmp = iniCtx.lookup("ConnectionFactory");
             QueueConnectionFactory tcf = (QueueConnectionFactory) tmp;
             conn = tcf.createQueueConnection();
             session = conn.createQueueSession(false,
        } catch (Exception e) {
        public synchronized void send(Queue privateQueue, Pkg log) throws Exception{
             QueueSender send = session.createSender(privateQueue);
             ObjectMessage logs = session.createObjectMessage(log);



      error rise up when i create sender 


      at org.hornetq.jms.client.HornetQSession.createProducer(HornetQSession.java:319)

      at org.hornetq.jms.client.HornetQSession.createSender(HornetQSession.java:834).


      I don't know why is not working.

      Some advice???

      workaround will be create one static queue for every client but will be uncomfortable when client will add to infrastructure.