Hello Everyone,

Enviroment jboss 4.0.1 on windows xp.
When i call QueueReceiver.setMessageListener i get next exception
Whats wrong ? Or can anybody point me to the right way ?


  | javax.jms.IllegalStateException: Method not allowed
  |         at 
org.jboss.resource.adapter.jms.JmsSession.checkStrict(JmsSession.java:399)
  |         at 
org.jboss.resource.adapter.jms.JmsMessageConsumer.setMessageListener(JmsMessageConsumer.java:111)
  |         at com.lcp.core.gate.Gate.<init>(Gate.java:44)
  | 

source is 


  | package com.lcp.core.gate;
  | 
  | import com.lcp.core.IStat;
  | import com.lcp.util.configHelper;
  | import com.lcp.exception.MustBeImplementedInDerivedClass;
  | 
  | import javax.jms.*;
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | import org.apache.log4j.Logger;
  | 
  | public class Gate implements IGate, MessageListener {
  | 
  |     private static final Logger log = 
Logger.getLogger(configHelper.LoggerName);
  | 
  |     protected QueueConnection queueConnection = null;
  |     protected QueueSession queueSession = null;
  |     protected QueueSender queueSender = null;
  |     protected Context jndiContext = null;
  |     protected QueueConnectionFactory queueConnectionFactory = null;
  |     protected Queue queue = null;
  |     protected QueueReceiver queueReceiver = null;
  |     protected String queueName = null;
  | 
  | 
  |     public Gate(String oper_id) throws JMSException {
  |         super();
  |         try {
  |             jndiContext = new InitialContext();
  |             queueConnectionFactory = (QueueConnectionFactory) 
jndiContext.lookup("java:JmsXA"); // todo think how to send queue name
  |             System.out.println(">>>>>>>>>>>>>> queueConnectionFactory " + 
queueConnectionFactory);
  |             Object o = 
jndiContext.lookup(configHelper.getValue("lcp.queue.prefix") + oper_id);
  |             System.out.println(">>>>>>>>>>>>>> o " + o);
  |             queue = (Queue) o;
  |             queueConnection = 
queueConnectionFactory.createQueueConnection();
  |             System.out.println(">>>>>>>>>>>>>> queueConnection " + 
queueConnection);
  |             queueSession = queueConnection.createQueueSession(false, 
Session.AUTO_ACKNOWLEDGE);
  |             System.out.println(">>>>>>>>>>>>>> queueSession " + 
queueSession);
  |             queueSender = queueSession.createSender(queue);
  |             System.out.println(">>>>>>>>>>>>>> queueSender " + queueSender);
  |             queueReceiver = queueSession.createReceiver(queue);
  |             queueReceiver.setMessageListener(new Gate());
  |         } catch (NamingException e) {
  |             log.error("NamigException", e);
  |         }
  |     }
  | 
  |     public Gate() {
  |         super(); // just empty constructor for listener
  |         System.out.println(">>>>>>>>>>>>>>>>>>>>>>> Gate with empty 
constructor");
  |     }
  | 
  |     public void SendViaJMS(String stat_id) {
  |         try {
  |             TextMessage statMessage = queueSession.createTextMessage();
  |             statMessage.setText(stat_id);
  |             queueSender.send(statMessage);
  |         } catch (JMSException e) {
  |             log.error("Cant send message to JMS", e);
  |         }
  |     }
  | 
  |     public void SendViaJMS(IStat Stat) {
  |         SendViaJMS(Stat.getStat_id());
  |     }
  | 
  |     public void ProcessMessage(String msg) throws 
MustBeImplementedInDerivedClass {
  |         throw new MustBeImplementedInDerivedClass("Must be Implemented In 
Derived class");
  |     }
  | 
  |     public void onMessage(Message message) {
  |         TextMessage tmstat_id = (TextMessage) message;
  |         try {
  |             System.out.println(">>>>>>>>>>>>>>> text message = " + 
tmstat_id.getText());
  |         } catch (JMSException e) {
  |             e.printStackTrace();  //To change body of catch statement use 
File | Settings | File Templates.
  |         }
  |     }
  | 
  | }
  | 
  | 


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872825#3872825

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872825


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to