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 ?