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/25 05:12:16 UTC
[jira] [Updated] (TOMEE-907) WARNING - Could NOT lazily initialize
session context because of null RequestContext
[ https://issues.apache.org/jira/browse/TOMEE-907?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard W. Smith, Jr. updated TOMEE-907:
---------------------------------------
Attachment: LoginFilter.java
Will go ahead and share my LoginFilter. My LoginFilter references my CDI @SessionScoped user bean.
It's interesting that my @ApplicationScoped bean is NOT a private attribute of LoginFilter, but the @SessionScoped user bean is private attribute of LoginFilter.
Hmmm... don't know why I defined them differently, but I did that (many) months ago.
> 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
> Labels: context, lazyStartSessionContext, session-context
> Attachments: LoginFilter.java
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> 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