As per your response in your email below, how can I get HttpSessionListener
system.out.println messages to show in the console?

I just logged into my app, undeployed the web app from TomEE, and the
following is in the console. When I use Glassfish, my session listener
system.out.println msgs show in console.

pf_UsersController.logout(): administrator logged out at Mon Nov 26
10:19:14 EST 2012
pf_UsersController.loginUser(): administrator logged in at Mon Nov 26
10:19:31 EST 2012
ApplicationScopeBean.destroy() invoked
DerbyUtil.java: shutdown() invoked
DerbyUtil.java: loadDriver(): Loaded driver
(org.apache.derby.jdbc.EmbeddedDriver) successfully
DerbyUtil.java: shutdown(): Derby shut down normally
Nov 26, 2012 10:19:56 AM org.apache.openejb.assembler.classic.Assembler
destroyApplication
INFO: Undeploying app: C:\Users\Public\NetBeansProjects\mcms\build\web
[EL Info]: 2012-11-26
10:19:58.287--ServerSession(1641308801)--file:/C:/Users/Public/NetBeansProjects/mcms/build/web/WEB-INF/classes/_mcmsPU
logout successful
Nov 26, 2012 10:19:58 AM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/mcmsweb] created a ThreadLocal with key of
type [com.google.api.client.util.escape.Platform$1] (value
[com.google.api.client.util.escape.Platform$1@2c4a9807]) and a value of
type [char[]] (value [[C@55430a48]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to try
and avoid a probable memory leak.
Nov 26, 2012 10:19:58 AM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/mcmsweb] created a ThreadLocal with key of
type [com.google.gson.Gson$1] (value [com.google.gson.Gson$1@17d81269]) and
a value of type [java.util.HashMap] (value [{}]) but failed to remove it
when the web application was stopped. Threads are going to be renewed over
time to try and avoid a probable memory leak.
Nov 26, 2012 10:19:59 AM org.apache.catalina.startup.HostConfig
deleteRedeployResources
INFO: Undeploying context [/mcmsweb]



On Mon, Nov 26, 2012 at 3:22 AM, Romain Manni-Bucau
<rmannibu...@gmail.com>wrote:

> found back how to get the error with the default settings
>
> -> this error is in apache-tomee/logs/localhost*.log but not in the console
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
>
> 2012/11/26 Howard W. Smith, Jr. <smithh032...@gmail.com>
>
> > CDI error? interesting.
> >
> > logger to activate? you must be talking about JULI and logging properties
> > file. I need to start using that, ASAP, instead of
> >
> >
> > On Sun, Nov 25, 2012 at 6:09 PM, Romain Manni-Bucau
> > <rmannibu...@gmail.com>wrote:
> >
> > > Mainly cdi error.
> > >
> > > Dont remember the logger to activate right now. Personally i debug
> > > standardcontext.listenerstart method (in tomcat-catalina jar) with a
> > > breakpoint in catch blocks
> > > Le 26 nov. 2012 00:05, "Howard W. Smith, Jr." <smithh032...@gmail.com>
> a
> > > écrit :
> > >
> > > > Hmmm interesting. So what would possibly cause listener not get
> > created?
> > > >
> > > > I think I saw http session listener in log but not my system log
> > prints.
> > > > On Nov 25, 2012 5:58 PM, "Romain Manni-Bucau" <rmannibu...@gmail.com
> >
> > > > wrote:
> > > >
> > > > > Hard to say since i build it locally but yesterday should be fine
> > > > >
> > > > > 2 more points:
> > > > > 1) this totally relies on tomcat
> > > > > 2) if the listener cant be created tomcat (not tomee) can swallow
> the
> > > > > exception by defaut so maybe thats your issue
> > > > > Le 25 nov. 2012 23:54, "Howard W. Smith, Jr." <
> > smithh032...@gmail.com>
> > > a
> > > > > écrit :
> > > > >
> > > > > > Which snapshot did you test with? 2012-11-24 or 2012-11-25?
> > > > > >  On Nov 25, 2012 5:51 PM, "Romain Manni-Bucau" <
> > > rmannibu...@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > In openejb no, in tomee yes and it works (tested yesterday)
> > > > > > >
> > > > > > > If not please just share a maven project (one command before
> > > testing)
> > > > > > > reproducing the issue
> > > > > > > Le 25 nov. 2012 23:26, "Howard W. Smith, Jr." <
> > > > smithh032...@gmail.com>
> > > > > a
> > > > > > > écrit :
> > > > > > >
> > > > > > > > Please see the following and let me know is this available in
> > > > > OpenEJB:
> > > > > > > >
> > > > > > > > Interface HttpSessionListener<
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpSessionListener.html
> > > > > > > > >
> > > > > > > >
> > > > > > > > As I demonstrated earlier, in a previous email (below), this
> is
> > > not
> > > > > > > working
> > > > > > > > in OpenEJB. Should I open a JIRA for this?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Sun, Nov 25, 2012 at 2:57 AM, Romain Manni-Bucau
> > > > > > > > <rmannibu...@gmail.com>wrote:
> > > > > > > >
> > > > > > > > > I dont think you can by default (at least hope otherwise
> > would
> > > > > > probably
> > > > > > > > be
> > > > > > > > > a security issue)
> > > > > > > > > Le 25 nov. 2012 08:50, "Howard W. Smith, Jr." <
> > > > > > smithh032...@gmail.com>
> > > > > > > a
> > > > > > > > > écrit :
> > > > > > > > >
> > > > > > > > > > Interesting. Glassfish always trigger my
> > > > > UserBean.sessionTimeout()
> > > > > > > via
> > > > > > > > > > HttpSessionListener.sessionDestroyed, when I undeploy app
> > or
> > > > > > shutdown
> > > > > > > > > > server.  Maybe this type of behavior/feature is
> > > > > > > > > > container-specific.whether/not sessions are persisted at
> > > > > shutdown?
> > > > > > > > > >
> > > > > > > > > > Hmmm, user A opens session, server shuts down while user
> A
> > > > logged
> > > > > > > > in... I
> > > > > > > > > > guess this is beneficial for when server comes back up,
> > user
> > > A
> > > > > can
> > > > > > > > resume
> > > > > > > > > > his work. Right?
> > > > > > > > > >
> > > > > > > > > > If so, my brother asked me if my web app could 'persist'
> > > > session
> > > > > if
> > > > > > > he
> > > > > > > > > > loses (internet) connection to the server. I guess my app
> > > does
> > > > > not
> > > > > > > > > persist
> > > > > > > > > > and resume 'persisted' sessions, or maybe I didn't know
> how
> > > to
> > > > > turn
> > > > > > > on
> > > > > > > > > that
> > > > > > > > > > feature when I was develop app for Glassfish.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Is there a JVM or tomcat/tomee container option for
> > > > > > > > > >
> > > > > > > > > > On Sun, Nov 25, 2012 at 2:41 AM, Romain Manni-Bucau
> > > > > > > > > > <rmannibu...@gmail.com>wrote:
> > > > > > > > > >
> > > > > > > > > > > Hmm,
> > > > > > > > > > >
> > > > > > > > > > > Sessions are persisted so you cant destroy a session
> > from a
> > > > > > session
> > > > > > > > > > events
> > > > > > > > > > > excepted the timeout which will do it automatically
> > > > > > > > > > > Le 25 nov. 2012 08:36, "Howard W. Smith, Jr." <
> > > > > > > > smithh032...@gmail.com>
> > > > > > > > > a
> > > > > > > > > > > écrit :
> > > > > > > > > > >
> > > > > > > > > > > > Interesting. So, when server shutdown, sessions are
> not
> > > > > > > destroyed?
> > > > > > > > > > > >
> > > > > > > > > > > > If the answer is yes, I guess you are telling me
> that I
> > > > > should
> > > > > > > > invoke
> > > > > > > > > > > > session.invalidate() in a @PreDestroy of my CDI
> > > > > @SessionScoped
> > > > > > > > > > UserBean?
> > > > > > > > > > > >
> > > > > > > > > > > > I have a sessionTimeout method on my UserBean
> already,
> > it
> > > > is
> > > > > > > > usually
> > > > > > > > > > > called
> > > > > > > > > > > > by HttpSessionListener on sessionDestroyed.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Sun, Nov 25, 2012 at 2:27 AM, Romain Manni-Bucau
> > > > > > > > > > > > <rmannibu...@gmail.com>wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Because the session is not destroyed, you need to
> > > destroy
> > > > > it
> > > > > > or
> > > > > > > > > wait
> > > > > > > > > > > the
> > > > > > > > > > > > > session timeout
> > > > > > > > > > > > > Le 25 nov. 2012 07:21, "Howard W. Smith, Jr." <
> > > > > > > > > > smithh032...@gmail.com>
> > > > > > > > > > > a
> > > > > > > > > > > > > écrit :
> > > > > > > > > > > > >
> > > > > > > > > > > > > > I have the following defined for my
> > > > HttpSessionListener,
> > > > > > and
> > > > > > > I
> > > > > > > > > > don't
> > > > > > > > > > > > see
> > > > > > > > > > > > > it
> > > > > > > > > > > > > > being executed (or showing up in server log)
> when I
> > > > > > undeploy
> > > > > > > or
> > > > > > > > > > > > shutdown
> > > > > > > > > > > > > > TomEE.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > /*
> > > > > > > > > > > > > >  * To change this template, choose Tools |
> > Templates
> > > > > > > > > > > > > >  * and open the template in the editor.
> > > > > > > > > > > > > >  */
> > > > > > > > > > > > > > package pf;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > import java.util.Date;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > import javax.inject.Inject;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > import javax.servlet.annotation.WebListener;
> > > > > > > > > > > > > > import javax.servlet.http.HttpSessionEvent;
> > > > > > > > > > > > > > import javax.servlet.http.HttpSessionListener;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > import jsf.users.pf_UsersController;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > /**
> > > > > > > > > > > > > >  *
> > > > > > > > > > > > > >  * @author Administrator
> > > > > > > > > > > > > >  */
> > > > > > > > > > > > > > @WebListener
> > > > > > > > > > > > > > public class UserHttpSessionListener implements
> > > > > > > > > > HttpSessionListener {
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >     @Inject
> > > > > > > > > > > > > >     private pf_UsersController userBean;
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >     @Override
> > > > > > > > > > > > > >     public void sessionCreated(HttpSessionEvent
> > > event)
> > > > {
> > > > > > > > > > > > > >         // Do here the job.
> > > > > > > > > > > > > >     }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >     @Override
> > > > > > > > > > > > > >     public void sessionDestroyed(HttpSessionEvent
> > > > event)
> > > > > {
> > > > > > > > > > > > > >         /*
> > > > > > > > > > > > > >          * JSF Managed Beans
> > > > > > > > > > > > > >          *
> > > > > > > > > > > > > >         pf_UsersController userBean =
> > > > > (pf_UsersController)
> > > > > > > > > > > > > > event.getSession().
> > > > > > > > > > > > > >
> > > > > > > > > > > > getAttribute("pf_usersController");
> > > > > > > > > > > > > >          */
> > > > > > > > > > > > > >         if (userBean != null &&
> userBean.getUser()
> > !=
> > > > > > null) {
> > > > > > > > > > > > > >             String userName =
> > > > > > > userBean.getUser().getUserName();
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > System.out.println("UserHttpSessionListener.sessionDestroyed():
> > > > > > > > > > > > > > " +
> > > > > > > > > > > > > >                                userName + "
> session
> > > > > > > > destroyed");
> > > > > > > > > > > > > >             userBean.sessionTimeout();
> > > > > > > > > > > > > >         }
> > > > > > > > > > > > > >     }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to