This discussion is archived
5 Replies Latest reply: Nov 22, 2012 11:13 PM by Kayaman RSS

Help about an EJB session context issue

975730 Newbie
Currently Being Moderated
Hi,

I am working on a servlet application which invokes a web service. This web service is an ejb based web service which has also some utility classes. One utility class is getting ejbsession context parameter from a bean class and trying to get message context from that ejb session context variable but it fails there. I get an illegalstateexception. Here is the error trace :

java.lang.IllegalStateException: SessionBean: getMessageContext not allowed from Non-WebService Endpoint method
[11/22/12 14:47:08:542 EET] 00000051 SystemErr      at com.ibm.ejs.container.SessionBeanO.getMessageContext(SessionBeanO.java:334)


Almostly all the ejb forums i have visited are telling that it resulted because of that fact that session context is in a wrong state and it can not invoke getMessageContext method. During debug activity i am changing the value of ejb session context variable just to find the true state but it doesnt work for any state. When i inspect ejb session context variable i see four session context state strings, They are : [DESTROYED, POOLED, IN_METHOD, PRE_CREATE]. The error comes with the session context variable happen when it has IN_METHOD state. I tried to change the value of the state to the other ones that i have listed below, but it doesnt work. I dont know what is going wrong, what must i do ?

Thanks for your help and attention..
  • 1. Re: Help about an EJB session context issue
    Kayaman Guru
    Currently Being Moderated
    972727 wrote:
    One utility class is getting...
    So you're in a method that's not a webservice endpoint method?
    getMessageContext not allowed from Non-WebService Endpoint method
  • 2. Re: Help about an EJB session context issue
    gimbal2 Guru
    Currently Being Moderated
    Kayaman wrote:
    972727 wrote:
    One utility class is getting...
    So you're in a method that's not a webservice endpoint method?
    getMessageContext not allowed from Non-WebService Endpoint method
    Yeah normally you get vague error messages but this one is quite definitive if you ask me. Its also something that you can easily copy/paste into Google.
  • 3. Re: Help about an EJB session context issue
    975730 Newbie
    Currently Being Moderated
    Yes Kayaman, you are right, i am getting this error in a method which is not a web service end point.

    Edited by: 972727 on Nov 22, 2012 7:47 AM
  • 4. Re: Help about an EJB session context issue
    975730 Newbie
    Currently Being Moderated
    Thx gimbal2, yes it is definitive enough, but when i look for the solution in other forums whenever i search in google, almostly the answer is the same: "session context is in a wrong state and because of that it can not invoke getMessageContext method". So, i am making a step by step debugging and i am inspecting session context variable in the code, and changing state info. of session context to other possible states, but i am getting the same error, what can i do else ?
  • 5. Re: Help about an EJB session context issue
    Kayaman Guru
    Currently Being Moderated
    972727 wrote:
    So, i am making a step by step debugging and i am inspecting session context variable in the code, and changing state info.
    You're trying to do something that isn't allowed. Using a debugger to try to get around it will probably result in a crash.

    So you can't do what you're trying to do. Find another way to do it.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points