Skip to main content

webcontext is null

Posted by prajith1234 on July 3, 2012 at 3:23 AM PDT

Summary

@Resource private static WebServiceContext context; @WebMethod public static void invoke() { MessageContext mc = context.getMessageContext(); HttpSession session = ((javax.servlet.http.HttpServletRequest) mc .get(MessageContext.SERVLET_REQUEST)).getSession(); if (session == null) throw new WebServiceException("No HTTP Session found"); System.out.println("SessionID: " + session.getId()); System.out.println("SessionID: " + session.getId()); WebServiceContext is null how can slove this problem