0 Replies Latest reply on Sep 12, 2011 9:04 AM by Vijay DR

    JMS - duplicate message in Jboss 4.1, but working fine in Weblogic 6

    Vijay DR Newbie

      We have a application which created in
      weblogic 6
      jdk1.3

      now we migrate the same into jboss 4.1 with jdk1.6

      Issues


      1. performance is very slow
      2. duplicate message calling [it calls repeatedly, so output is like duplicate]


      here is our weblogic 6 jms setting

       

      1. <JMSConnectionFactory AllowCloseInOnMessage="false" 
      2.         DefaultDeliveryMode="Persistent" DefaultPriority="4" 
      3.         DefaultTimeToLive="0" 
      4.         JNDIName="com.query.QueryConnectionFactory" 
      5.         MessagesMaximum="-1" Name="Query Connection Factory" 
      6.         OverrunPolicy="KeepOld" Targets="myserver" TransactionTimeout="900"/> 



      Java code  [queue name we created like mbean] and no problem in the code it works.

       

       

      1. private final static String JMS_FACTORY="com.query.QueryConnectionFactory"
      2.   private final static String QUEUE_NAME="com.QueryQueue"
      3.   
      4.   private static Context ctx; 
      5.      
      6.   // todo:   
      7.   // can the connection and other variables be lazily created and stored 
      8.   // as private variables instead of each time? 
      9.   public final static void dispatchQuery(String sessionDirectory, 
      10.                                          final QueryInfo queryInfo)  
      11.                                          throws ControllerException { 
      12.         try 
      13.         { 
      14.             
      15.             ctx = getInitialContext(); 
      16.                
      17.             QueueConnectionFactory cf = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY); 
      18.          
      19.             QueueConnection queueConnection = cf.createQueueConnection(); 
      20.             queueConnection.start(); 
      21.          
      22.             QueueSession session = queueConnection.createQueueSession(false,   // non-transacted 
      23.                                                          Session.AUTO_ACKNOWLEDGE); 
      24.                
      25.             log("Session is: " + session); 
      26.                
      27.             Queue queue = null; 
      28.              
      29.             try 
      30.             { 
      31.                 queue = (Queue) ctx.lookup(QUEUE_NAME); 
      32.             } catch (NamingException ne) { 
      33.                 try 
      34.                 { 
      35.                     queue = session.createQueue(QUEUE_NAME); 
      36.                     ctx.bind(QUEUE_NAME, queue); 
      37.                 } catch (Exception e) { 
      38.                     e.printStackTrace(); 
      39.                 } 
      40.             } 
      41.                      
      42.             log("Queue is: " + queue); 
      43.                
      44.             QueueSender sender = session.createSender(queue); 
      45.                
      46.             QueryMessage queryMessage = new QueryMessage(sessionDirectory, queryInfo); 
      47.             ObjectMessage om = session.createObjectMessage(queryMessage); 
      48.             log("<<< DISPATCHER.. >> Before Sending message of " + om); 
      49.             sender.send(om); 
      50.             log("Sent message.");   
      51.         } catch (JMSException je) { 
      52.             String message = "Could not send the message due to:\n" + 
      53.                              je.getMessage(); 
      54.             throw new ControllerException(message); 
      55.         } catch (NamingException ne) { 
      56.             throw new ControllerException(ne.getMessage()); 
      57.         } 
      58.   } 



      JBoss 4.1, the same code not working perfectly.

      jbossmq-destinations-service.xml

       

      1. <mbean code="org.jboss.mq.server.jmx.Queue"  
      2.       name="jboss.mq.destination:service=Queue,name=com.query.QueryQueue">  
      3.       <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> 
      4.     </mbean>  


      JAVA, we used UIL2ConnectionFactory

       

       

      1. private final static String JMS_FACTORY="UIL2ConnectionFactory";  
      2.   private final static String QUEUE_NAME="queue/com.query.QueryQueue"
      3.  
      4. // rest of the code is same as above.