0 Replies Latest reply on Dec 13, 2014 1:49 PM by andre.cesar

    Problems send a JMS message from JBoss 4.0.5 GA to Websphere AS 8.5

    andre.cesar

      Hi all,

       

      I'm doing a POC application using JMS, where I need to send a message from a Message-Driven Bean running in my JBoss 4.0.5 GA (really old,

      but the company still using...) to a queue, in WebSphere Application Server 8.5.

      We are migrating some applications to WebSphere, so, to stil "talking", the idea is create a this MDB, who listen the JBoss queue and

      route to the WebSphere.

      Has someone made something like that? Any idea about which classes or jars are necessary to do it? We are having many (MANY) problems after a message arrive in JBoss MDB and instance the classes to send the message to WebSphere, like ClassCast of WebSphere client class (that are in my classpath) .

      Any help or example, I apreciate. Sorry about my english.

       

       

      That's my code:

      public void onMessage(Message msg) {
           TextMessage txt = (TextMessage) msg;
           try {
           Properties env = new Properties();
           env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
           env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
           env.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
      
      
        Context iniCtx = new InitialContext(env);
      
      
        Object tmp = iniCtx.lookup("jms/qcf");
        QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
        QueueConnection conn = qcf.createQueueConnection();
        Queue que = (Queue) iniCtx.lookup("jms/pocQueue");
        QueueSession session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
        conn.start();
      
      
        QueueReceiver recv = session.createReceiver(que);
      
      
        // Send a text msg
        QueueSender send = session.createSender(que);
        TextMessage tm = session.createTextMessage("<<<<<<<<<<<<<<<<<<<< RouterMDB to WAS - test >>>>>>>>>>>>>>>>>>>>>>>>");
        send.send(tm);
        send.close();
      
        } catch (JMSException e) {
        e.printStackTrace();
        } catch (NamingException e) {
        e.printStackTrace();
        }