views:

23

answers:

1

I am working on JAX-WS webservice and sometimes on heavy load i am getting HttpSession "null". This is how I am getting the session:

MessageContext mc = wsContext.getMessageContext(); HttpSession session=((HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession(); if(session==null) { logger.warn("Session is null"); }

I am using JBoss 5

Thanks | Abhi

A: 

change the code to to:

session=((HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession(true);

mohammad shamsi
what does this mean? I mean what will happen if we pass "true" as an argument?
Abhishek
it will create new session, if session is null and not created yet.
mohammad shamsi
Still the same result. I guess bydefault the create parameter to getSession is true.
Abhishek