Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAX-WS Sessions

843833Jun 23 2008
Hello,

I wonder if anybody could help me with this?

I'm running a jax-ws webservice through glassfish, and I'm trying to get hold of the session using the following code:
MessageContext mc = context.getMessageContext();
HttpServletRequest r = (HttpServletRequest)mc.get(MessageContext.SERVLET_CONTEXT);
HttpSession s = r.getSession();
I got this code from the following tutorial:
https://jax-ws-commons.dev.java.net/http-session-scope/

However, mc.get(MessageContext.SERVLET_CONTEXT) does not seem to return an HttpServletRequest! Rather I get the following error message:
org.apache.catalina.core.ApplicationContextFacade cannot be cast to javax.servlet.http.HttpServletRequest
This seems strange to me. Why is glassfish returning an Apache object? Does anybody know what's going on here, and how I can get hold of the HttpSession object?

Thanks a lot in advance,

Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2008
Added on Jun 23 2008
0 comments
189 views