javax.jms.IllegalStateException: Method Not AllowedException...your help will be highly appreciated - Websphere

This is a discussion on javax.jms.IllegalStateException: Method Not AllowedException...your help will be highly appreciated - Websphere ; Hi, I am working in JMS on websphere V4 MQ series. I am getting following exception while setting listener to QueueReceiver with the following code. Please help me with the reason and solution.I will highly appreciate your help. Code :- ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: javax.jms.IllegalStateException: Method Not AllowedException...your help will be highly appreciated

  1. javax.jms.IllegalStateException: Method Not AllowedException...your help will be highly appreciated

    Hi,

    I am working in JMS on websphere V4 MQ series. I am getting following exception while setting listener to QueueReceiver with the following code.
    Please help me with the reason and solution.I will highly appreciate your help.


    Code :-

    Queue queue = CASQueueFactory.getInstance().getQueue(queueName);

    QueueConnection connection = CASQueueFactory.getInstance().getQueueConnection(q ueueConnectionFactory);

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

    QueueReceiver queueReceiver = session.createReceiver( queue );

    queueReceiver.setMessageListener(this);

    Code is working fine till session.createReceiver( queue ) but fails while setting messagelistener with the following exception :-

    javax.jms.IllegalStateException: Method Not Allowed Exception
    at com.ibm.ejs.jms.mq.JMSWrapMessageConsumer.setMessa geListener(JMSWrapMessageCons
    umer.java:137)
    at com.dixons.oms.mq.CASInboundMessageListener.(CASInboundMessageListener.ja
    va:58)
    at com.dixons.oms.MQListenerStartupServlet.init(MQLis tenerStartupServlet.java:27)
    at com.ibm.servlet.engine.webapp.StrictServletInstanc e.doInit(ServletManager.java:
    802)
    at com.ibm.servlet.engine.webapp.StrictLifecycleServl et._init(StrictLifecycleServl
    et.java:141)
    at com.ibm.servlet.engine.webapp.PreInitializedServle tState.init(StrictLifecycleSe
    rvlet.java:254)
    802)
    at com.ibm.servlet.engine.webapp.StrictLifecycleServl et._init(StrictLifecycleServl
    et.java:141)
    at com.ibm.servlet.engine.webapp.PreInitializedServle tState.init(StrictLifecycleSe
    rvlet.java:254)
    at com.ibm.servlet.engine.webapp.StrictLifecycleServl et.init(StrictLifecycleServle
    t.java:107)
    at com.ibm.servlet.engine.webapp.ServletInstance.init (ServletManager.java:388)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
    at com.ibm.servlet.engine.webapp.ServletManager.addSe rvlet(ServletManager.java:84)
    at com.ibm.servlet.engine.webapp.WebAppServletManager .loadServlet(WebAppServletMan
    ager.java:211)
    at com.ibm.servlet.engine.webapp.WebAppServletManager .loadAutoLoadServlets(WebAppS
    ervletManager.java:350)

    Warm regards
    Akash


  2. Re: javax.jms.IllegalStateException: Method Not Allowed Exception...yourhelp will be highly appreciated

    taneja.akash@gmail.com wrote:
    > Code is working fine till session.createReceiver( queue ) but
    > fails while setting messagelistener with the following
    > exception :-
    >
    > javax.jms.IllegalStateException: Method Not Allowed Exception
    > at
    > com.ibm.ejs.jms.mq.JMSWrapMessageConsumer.setMessa geListener(JMSWrapMessageCons
    > umer.java:137) at


    From the WAS 6 manual at
    http://publib.boulder.ibm.com/infoce...tmj_desap.html

    (NB MessageConsumer is equivalent to QueueReceiver in JMS 1.0 in
    WAS 4)

    ------------
    The section "Java Message Service (JMS) Requirements" of the J2EE
    specification gives a list of methods that must not be called in
    Web and EJB containers:

    ....
    javax.jms.MessageConsumer method setMessageListener
    ....

    This method restriction is enforced in IBM WebSphere Application
    Server by throwing a javax.jms.IllegalStateException.
    ------------

    Check the documentation, looks like you are not following the
    J2EE spec.

    Andy
    --
    http://andypiper.wordpress.com/

  3. Re: javax.jms.IllegalStateException: Method Not Allowed Exception...yourhelp will be highly appreciated

    Andy Piper wrote:
    > taneja.akash@gmail.com wrote:
    >> Code is working fine till session.createReceiver( queue ) but
    >> fails while setting messagelistener with the following
    >> exception :-
    >>
    >> javax.jms.IllegalStateException: Method Not Allowed Exception at

    >
    > From the WAS 6 manual at
    > http://publib.boulder.ibm.com/infoce...tmj_desap.html


    Here is the WAS 4 manual statement on this issue:

    http://publib.boulder.ibm.com/infoce.../04060304.html

    Andy

    --
    http://andypiper.wordpress.com/

+ Reply to Thread