0 Replies Latest reply on Nov 18, 2014 6:27 PM by ermaki

    problem connecting to my jms queue. Can you help me please?

    ermaki

      hello

      i have one MDB with the next definition but when i try to use the queue from one main class always appears one error.

      i am working into this problem during 3 days and i don't know how to solve it.

      can you help me please?

       

      the definition of my mdb is:

      @MessageDriven(mappedName= "queues/myprojectInternalMessageQueue", activationConfig = {

        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

        @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "JMS_INTERNAL_MESSAGE_TYPE = 'JMS_INTERNAL_REGISTER'"),

        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),

        @ActivationConfigProperty(propertyName = "destination",   propertyValue = "queues/myprojectInternalMessageQueue"),

        @ActivationConfigProperty(propertyName = "user", propertyValue = "myuser"),

              @ActivationConfigProperty(propertyName = "password", propertyValue = "ZKERMTIzNHF3345ZXJf"),

              @ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),

              @ActivationConfigProperty(propertyName = "setupAttempts", propertyValue = "-1"),

              @ActivationConfigProperty(propertyName="connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),

              @ActivationConfigProperty(propertyName="connectionParameters", propertyValue = "host=localhost;port=5455"),

        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})

      public class testMDB  implements MessageListener {

      ......

       

      when i deployed this appears into the log:

      00:18:33,788 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Entrada de ruta de clase testMDB-0.0.1-SNAPSHOT.jar en /content/testEAR.ear no apunta a una jar válida para una referencia  Class-Path.

      ............

      00:18:33,853 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) JBAS014142: Inició el bean dirigido por mensajes 'testMDB' con el adaptador de recursos 'hornetq-ra'

      00:18:33,858 INFO  [org.hornetq.ra] (default-threads - 10) HQ151004: Instantiating javax.jms.Queue "queues/myprojectInternalMessageQueue" directly since UseJNDI=false.

      00:18:33,867 INFO  [org.hornetq.ra] (default-threads - 10) HQ151005: awaiting HornetQ Server availability

      00:18:33,882 INFO  [org.jboss.as.server] (host-controller-connection-threads - 19) JBAS018559: Implementado "testEAR.ear" (runtime-name : "testEAR.ear")

      00:18:35,878 INFO  [org.hornetq.ra] (default-threads - 10) HQ151001: Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@7667bfa7 destination=queues/myprojectInternalMessageQueue destinationType=javax.jms.Queue selector=JMS_INTERNAL_MESSAGE_TYPE = 'JMS_INTERNAL_STEP1_REGISTER' ack=Auto-acknowledge durable=false clientID=null user=admin password=**** maxSession=15)

      00:18:35,878 INFO  [org.hornetq.ra] (default-threads - 10) HQ151004: Instantiating javax.jms.Queue "queues/myprojectInternalMessageQueue" directly since UseJNDI=false.

      00:18:37,884 INFO  [org.hornetq.ra] (default-threads - 10) HQ151004: Instantiating javax.jms.Queue "queues/myprojectInternalMessageQueue" directly since UseJNDI=false.

       

      if i run one test against the queue from one main class apears this error into logs:

      00:19:25,064 ERROR [org.hornetq.core.client] (Old I/O server worker (parentId: -1748511148, [id: 0x97c7d654, /128.20.82.227:5445])) HQ214013: Failed to decode packet: java.lang.IllegalArgumentException: HQ119032: Invalid type: -1

        at org.hornetq.core.protocol.core.impl.PacketDecoder.decode(PacketDecoder.java:434) [hornetq-core-client-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.hornetq.core.protocol.ServerPacketDecoder.decode(ServerPacketDecoder.java:180) [hornetq-server-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:485) [hornetq-core-client-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:564) [hornetq-server-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:72) [hornetq-core-client-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:281) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-client-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-client-2.3.12.Final-redhat-1.jar:2.3.12.Final-redhat-1]

        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:71) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175) [netty-3.6.6.Final-redhat-1.jar:3.6.6.Final-redhat-1]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

       

       

       

      the code of my client is:

       

       

      import java.util.Properties;

      import javax.jms.Connection;

      import javax.jms.ConnectionFactory;

      import javax.jms.JMSException;

      import javax.jms.MessageProducer;

      import javax.jms.ObjectMessage;

      import javax.jms.Queue;

      import javax.jms.QueueSession;

      import javax.jms.Session;

      import javax.jms.TextMessage;

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NamingException;

      public class JMSApplicationClient1 {

        public static void main(String[] args) {

              Connection connection;

              try {

            

                  final Properties env = new Properties();

                  env.put(Context.INITIAL_CONTEXT_FACTORY,

                  org.jboss.naming.remote.client.InitialContextFactory.class.getName());

                  env.put(Context.PROVIDER_URL, "remote://192.168.3.254:5445");

                  env.put(Context.SECURITY_PRINCIPAL, "admin");

                  env.put(Context.SECURITY_CREDENTIALS, "AWERTASAFASF");

                  Context remoteContext = new InitialContext(env);

                  

                  ConnectionFactory factory = (ConnectionFactory)remoteContext.lookup("queues/myprojectInternalMessageFactory");

                  Queue queue = (Queue) remoteContext.lookup("queues/myprojectInternalMessageQueue");

                  connection = factory.createConnection();

                  Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);

                  

                  MessageProducer producer = session.createProducer(queue);

                  

                  //1. Sending TextMessage to the Queue

                  TextMessage message = session.createTextMessage();

                  message.setText("Hello EJB3 MDB Queue!!!");

                  producer.send(message);

                  System.out.println("1. Sent TextMessage to the Queue");

                  

                  //2. Sending ObjectMessage to the Queue

                  ObjectMessage objMsg = session.createObjectMessage();

                 

                  objMsg.setObject("==VA TEST========");                    

                  producer.send(objMsg);

                  System.out.println("2. Sent ObjectMessage to the Queue");

                  

                  session.close();

              } catch (JMSException e) {

                  e.printStackTrace();

              } catch (NamingException e) {

                  e.printStackTrace();

              }              

          }

      }