You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Howard W. Smith, Jr. (JIRA)" <ji...@apache.org> on 2013/04/24 07:25:15 UTC

[jira] [Created] (TOMEE-907) WARNING - Could NOT lazily initialize session context because of null RequestContext

Howard W. Smith, Jr. created TOMEE-907:
------------------------------------------

             Summary: WARNING - Could NOT lazily initialize session context because of null RequestContext
                 Key: TOMEE-907
                 URL: https://issues.apache.org/jira/browse/TOMEE-907
             Project: TomEE
          Issue Type: Bug
    Affects Versions: 1.6.0
         Environment: N/A I'm using TomEE 1.6.0 snapshot 2013-03-27
            Reporter: Howard W. Smith, Jr.
            Priority: Minor


To prevent this from showing in the log 'always', when/during/after session expiration, please see my code changes below. Look for 'PLEASE MODIFY BELOW, accordingly:' below. Thanks.


    private Context lazyStartSessionContext() {

        if (logger.isDebugEnabled()) {
            logger.debug(">lazyStartSessionContext");
        }

        Context webContext = null;
        Context context = getCurrentContext(RequestScoped.class);
        if (context instanceof ServletRequestContext) {
            ServletRequestContext requestContext = (ServletRequestContext) context;
            HttpServletRequest servletRequest = requestContext.getServletRequest();
            if (null != servletRequest) { // this could be null if there is no active request context
                try {
                    HttpSession currentSession = servletRequest.getSession();
                    initSessionContext(currentSession);
//                    if (failoverService != null && failoverService.isSupportFailOver())
//                    {
//                        failoverService.sessionIsInUse(currentSession);
//                    }

                    if (logger.isDebugEnabled()) {
                        logger.debug("Lazy SESSION context initialization SUCCESS");
                    }
                } catch (Exception e) {
                    logger.error(OWBLogConst.ERROR_0013, e);
                }

            } else {

PLEASE MODIFY BELOW, accordingly:

*              if (logger.isDebugEnabled()) {
*                  logger.warning("Could NOT lazily initialize session context because NO active request context");
*              }

            }
        } else {

PLEASE MODIFY BELOW, accordingly:

*           if (logger.isDebugEnabled()) {
*               logger.warning("Could NOT lazily initialize session context because of " + context + " RequestContext");
*           }

        }

        if (logger.isDebugEnabled()) {
            logger.debug("<lazyStartSessionContext " + webContext);
        }
        return webContext;
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira