You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Michael Mathers <mi...@gmail.com> on 2013/11/13 04:33:16 UTC

Request/Session Lifecycle Events and Glassfish 4/Arquillian

I can't seem to catch these events.  I am using DS core and the servlet
module (0.5) and everything else appears to be working fine.  The
configuration stuff with ProjectStage is great stuff!

I can inject all of the Sevlet objects provided by the DS Servlet module
but I cannot receive the events.

I created an Arquillian test which pushes over a @WebServlet and then runs
the test.  The Servlet is initialized by Glassfish and is then called by
the test via a URL GET and successfully returns a response.  The test gets
the response but the events are never called.

The web.xml specifies 3.1.  I tried adding all the listeners in anyway and
it completely blew up (already registered).  Any suggestions?


INFO: class: org.apache.deltaspike.servlet.impl.event.EventBridgeFilter
activated=true
INFO: 20:07:57.079 [admin-listener(2)] INFO
 o.i.j.deltaspike.EventsITServlet - EventsITServlet servlet has been
initialized
INFO: Loading application [test] at [/collectortest]
INFO: test was successfully deployed in 2,643 milliseconds.
INFO: File /tmp/MIME2910438175498708242.tmp was not deleted
WARNING: The following warnings have been detected: WARNING: Parameter 1 of
type T from public void
org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setContextualInstance(T)
is not resolvable to a concrete type.
WARNING: Parameter 1 of type
javax.enterprise.context.spi.CreationalContext<T> from public void
org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setCreationalContext(javax.enterprise.context.spi.CreationalContext<T>)
is not resolvable to a concrete type.

INFO: 20:07:58.082 [http-listener-1(3)] DEBUG
o.i.j.deltaspike.EventsITServlet - Responded!
INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
org.ipd.jeetest.deltaspike.EventsIT - Returned Stream Line: EventsITServlet
Response
INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
org.ipd.jeetest.deltaspike.EventsIT - Events Observed: false, false, false,
false, false, false



public void onCreate(@Observes @Initialized HttpSession session) {
logger.debug("Session created: " + session.getId());
}
public void onDestroy(@Observes @Destroyed HttpSession session) {
logger.debug("Session destroyed: " + session.getId());
}
public void onRequestCreate(@Observes @Initialized HttpServletRequest
request) {
logger.debug("Request created: " + request.getRequestURI());
}
public void onRequestDestroy(@Observes @Destroyed HttpServletRequest
request) {
logger.debug("Request destroyed: " + request.getRequestURI());
}
public void onResponseCreate(@Observes @Initialized HttpServletResponse
response) {
logger.debug("Response created: ");
}
public void onResponseDestroy(@Observes @Destroyed HttpServletResponse
response) {
logger.debug("Response destroyed: ");
}

Re: Request/Session Lifecycle Events and Glassfish 4/Arquillian

Posted by Michael Mathers <mi...@gmail.com>.
Mystery resolved.  I had to go out and create a vanilla project to see what
idiotic thing I was doing.  I was including the wrong beans.xml to
Arquillian that was specifying only to scan for annotated beans.  Whoops.


On Thu, Nov 21, 2013 at 7:41 AM, Jason Porter <li...@gmail.com>wrote:

> That's really weird. I don't think I've ever seen that happen. Thinking
> about this for a minute, I'm really not sure what to suggest. Maybe the
> events have some additional qualifiers on them?
>
> —
> Sent from Mailbox for iPhone
>
> On Mon, Nov 18, 2013 at 8:00 PM, Michael Mathers
> <mi...@gmail.com> wrote:
>
> > I did finally get to this.  With a breakpoint on the the listeners I
> > verified that they get "isActivated" set to true, they are able to get a
> > BeanManager instance and call "fireEvent".  I just never see the event.
> > On Thu, Nov 14, 2013 at 10:05 AM, Christian Kaltepoth <
> > christian@kaltepoth.de> wrote:
> >> Hey Michael,
> >>
> >> I'm not aware of any compatibility issues with Glassfish 4. But AFAIK
> our
> >> integration test suite only runs against Glassfish 3.1. I'll try to find
> >> some time in the next days to add a Glassfish 4 profile to our suite.
> >>
> >> Apart from that you could do some debugging just to check if the
> >> corresponding listeners are executed. If they are executed they should
> also
> >> fire the events. The code isn't very complicated. See [1] and [2].
> >>
> >> Christian
> >>
> >> [1]
> >>
> >>
> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java#L53
> >> [2]
> >>
> >>
> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventEmitter.java#L47
> >>
> >>
> >>
> >> 2013/11/13 Michael Mathers <mi...@gmail.com>
> >>
> >> > I can't seem to catch these events.  I am using DS core and the
> servlet
> >> > module (0.5) and everything else appears to be working fine.  The
> >> > configuration stuff with ProjectStage is great stuff!
> >> >
> >> > I can inject all of the Sevlet objects provided by the DS Servlet
> module
> >> > but I cannot receive the events.
> >> >
> >> > I created an Arquillian test which pushes over a @WebServlet and then
> >> runs
> >> > the test.  The Servlet is initialized by Glassfish and is then called
> by
> >> > the test via a URL GET and successfully returns a response.  The test
> >> gets
> >> > the response but the events are never called.
> >> >
> >> > The web.xml specifies 3.1.  I tried adding all the listeners in anyway
> >> and
> >> > it completely blew up (already registered).  Any suggestions?
> >> >
> >> >
> >> > INFO: class:
> org.apache.deltaspike.servlet.impl.event.EventBridgeFilter
> >> > activated=true
> >> > INFO: 20:07:57.079 [admin-listener(2)] INFO
> >> >  o.i.j.deltaspike.EventsITServlet - EventsITServlet servlet has been
> >> > initialized
> >> > INFO: Loading application [test] at [/collectortest]
> >> > INFO: test was successfully deployed in 2,643 milliseconds.
> >> > INFO: File /tmp/MIME2910438175498708242.tmp was not deleted
> >> > WARNING: The following warnings have been detected: WARNING:
> Parameter 1
> >> of
> >> > type T from public void
> >> >
> >> >
> >>
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setContextualInstance(T)
> >> > is not resolvable to a concrete type.
> >> > WARNING: Parameter 1 of type
> >> > javax.enterprise.context.spi.CreationalContext<T> from public void
> >> >
> >> >
> >>
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setCreationalContext(javax.enterprise.context.spi.CreationalContext<T>)
> >> > is not resolvable to a concrete type.
> >> >
> >> > INFO: 20:07:58.082 [http-listener-1(3)] DEBUG
> >> > o.i.j.deltaspike.EventsITServlet - Responded!
> >> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> >> > org.ipd.jeetest.deltaspike.EventsIT - Returned Stream Line:
> >> EventsITServlet
> >> > Response
> >> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> >> > org.ipd.jeetest.deltaspike.EventsIT - Events Observed: false, false,
> >> false,
> >> > false, false, false
> >> >
> >> >
> >> >
> >> > public void onCreate(@Observes @Initialized HttpSession session) {
> >> > logger.debug("Session created: " + session.getId());
> >> > }
> >> > public void onDestroy(@Observes @Destroyed HttpSession session) {
> >> > logger.debug("Session destroyed: " + session.getId());
> >> > }
> >> > public void onRequestCreate(@Observes @Initialized HttpServletRequest
> >> > request) {
> >> > logger.debug("Request created: " + request.getRequestURI());
> >> > }
> >> > public void onRequestDestroy(@Observes @Destroyed HttpServletRequest
> >> > request) {
> >> > logger.debug("Request destroyed: " + request.getRequestURI());
> >> > }
> >> > public void onResponseCreate(@Observes @Initialized
> HttpServletResponse
> >> > response) {
> >> > logger.debug("Response created: ");
> >> > }
> >> > public void onResponseDestroy(@Observes @Destroyed HttpServletResponse
> >> > response) {
> >> > logger.debug("Response destroyed: ");
> >> > }
> >> >
> >>
> >>
> >>
> >> --
> >> Christian Kaltepoth
> >> Blog: http://blog.kaltepoth.de/
> >> Twitter: http://twitter.com/chkal
> >> GitHub: https://github.com/chkal
> >>
>

Re: Request/Session Lifecycle Events and Glassfish 4/Arquillian

Posted by Jason Porter <li...@gmail.com>.
That's really weird. I don't think I've ever seen that happen. Thinking about this for a minute, I'm really not sure what to suggest. Maybe the events have some additional qualifiers on them?

—
Sent from Mailbox for iPhone

On Mon, Nov 18, 2013 at 8:00 PM, Michael Mathers
<mi...@gmail.com> wrote:

> I did finally get to this.  With a breakpoint on the the listeners I
> verified that they get "isActivated" set to true, they are able to get a
> BeanManager instance and call "fireEvent".  I just never see the event.
> On Thu, Nov 14, 2013 at 10:05 AM, Christian Kaltepoth <
> christian@kaltepoth.de> wrote:
>> Hey Michael,
>>
>> I'm not aware of any compatibility issues with Glassfish 4. But AFAIK our
>> integration test suite only runs against Glassfish 3.1. I'll try to find
>> some time in the next days to add a Glassfish 4 profile to our suite.
>>
>> Apart from that you could do some debugging just to check if the
>> corresponding listeners are executed. If they are executed they should also
>> fire the events. The code isn't very complicated. See [1] and [2].
>>
>> Christian
>>
>> [1]
>>
>> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java#L53
>> [2]
>>
>> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventEmitter.java#L47
>>
>>
>>
>> 2013/11/13 Michael Mathers <mi...@gmail.com>
>>
>> > I can't seem to catch these events.  I am using DS core and the servlet
>> > module (0.5) and everything else appears to be working fine.  The
>> > configuration stuff with ProjectStage is great stuff!
>> >
>> > I can inject all of the Sevlet objects provided by the DS Servlet module
>> > but I cannot receive the events.
>> >
>> > I created an Arquillian test which pushes over a @WebServlet and then
>> runs
>> > the test.  The Servlet is initialized by Glassfish and is then called by
>> > the test via a URL GET and successfully returns a response.  The test
>> gets
>> > the response but the events are never called.
>> >
>> > The web.xml specifies 3.1.  I tried adding all the listeners in anyway
>> and
>> > it completely blew up (already registered).  Any suggestions?
>> >
>> >
>> > INFO: class: org.apache.deltaspike.servlet.impl.event.EventBridgeFilter
>> > activated=true
>> > INFO: 20:07:57.079 [admin-listener(2)] INFO
>> >  o.i.j.deltaspike.EventsITServlet - EventsITServlet servlet has been
>> > initialized
>> > INFO: Loading application [test] at [/collectortest]
>> > INFO: test was successfully deployed in 2,643 milliseconds.
>> > INFO: File /tmp/MIME2910438175498708242.tmp was not deleted
>> > WARNING: The following warnings have been detected: WARNING: Parameter 1
>> of
>> > type T from public void
>> >
>> >
>> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setContextualInstance(T)
>> > is not resolvable to a concrete type.
>> > WARNING: Parameter 1 of type
>> > javax.enterprise.context.spi.CreationalContext<T> from public void
>> >
>> >
>> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setCreationalContext(javax.enterprise.context.spi.CreationalContext<T>)
>> > is not resolvable to a concrete type.
>> >
>> > INFO: 20:07:58.082 [http-listener-1(3)] DEBUG
>> > o.i.j.deltaspike.EventsITServlet - Responded!
>> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
>> > org.ipd.jeetest.deltaspike.EventsIT - Returned Stream Line:
>> EventsITServlet
>> > Response
>> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
>> > org.ipd.jeetest.deltaspike.EventsIT - Events Observed: false, false,
>> false,
>> > false, false, false
>> >
>> >
>> >
>> > public void onCreate(@Observes @Initialized HttpSession session) {
>> > logger.debug("Session created: " + session.getId());
>> > }
>> > public void onDestroy(@Observes @Destroyed HttpSession session) {
>> > logger.debug("Session destroyed: " + session.getId());
>> > }
>> > public void onRequestCreate(@Observes @Initialized HttpServletRequest
>> > request) {
>> > logger.debug("Request created: " + request.getRequestURI());
>> > }
>> > public void onRequestDestroy(@Observes @Destroyed HttpServletRequest
>> > request) {
>> > logger.debug("Request destroyed: " + request.getRequestURI());
>> > }
>> > public void onResponseCreate(@Observes @Initialized HttpServletResponse
>> > response) {
>> > logger.debug("Response created: ");
>> > }
>> > public void onResponseDestroy(@Observes @Destroyed HttpServletResponse
>> > response) {
>> > logger.debug("Response destroyed: ");
>> > }
>> >
>>
>>
>>
>> --
>> Christian Kaltepoth
>> Blog: http://blog.kaltepoth.de/
>> Twitter: http://twitter.com/chkal
>> GitHub: https://github.com/chkal
>>

Re: Request/Session Lifecycle Events and Glassfish 4/Arquillian

Posted by Michael Mathers <mi...@gmail.com>.
I did finally get to this.  With a breakpoint on the the listeners I
verified that they get "isActivated" set to true, they are able to get a
BeanManager instance and call "fireEvent".  I just never see the event.


On Thu, Nov 14, 2013 at 10:05 AM, Christian Kaltepoth <
christian@kaltepoth.de> wrote:

> Hey Michael,
>
> I'm not aware of any compatibility issues with Glassfish 4. But AFAIK our
> integration test suite only runs against Glassfish 3.1. I'll try to find
> some time in the next days to add a Glassfish 4 profile to our suite.
>
> Apart from that you could do some debugging just to check if the
> corresponding listeners are executed. If they are executed they should also
> fire the events. The code isn't very complicated. See [1] and [2].
>
> Christian
>
> [1]
>
> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java#L53
> [2]
>
> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventEmitter.java#L47
>
>
>
> 2013/11/13 Michael Mathers <mi...@gmail.com>
>
> > I can't seem to catch these events.  I am using DS core and the servlet
> > module (0.5) and everything else appears to be working fine.  The
> > configuration stuff with ProjectStage is great stuff!
> >
> > I can inject all of the Sevlet objects provided by the DS Servlet module
> > but I cannot receive the events.
> >
> > I created an Arquillian test which pushes over a @WebServlet and then
> runs
> > the test.  The Servlet is initialized by Glassfish and is then called by
> > the test via a URL GET and successfully returns a response.  The test
> gets
> > the response but the events are never called.
> >
> > The web.xml specifies 3.1.  I tried adding all the listeners in anyway
> and
> > it completely blew up (already registered).  Any suggestions?
> >
> >
> > INFO: class: org.apache.deltaspike.servlet.impl.event.EventBridgeFilter
> > activated=true
> > INFO: 20:07:57.079 [admin-listener(2)] INFO
> >  o.i.j.deltaspike.EventsITServlet - EventsITServlet servlet has been
> > initialized
> > INFO: Loading application [test] at [/collectortest]
> > INFO: test was successfully deployed in 2,643 milliseconds.
> > INFO: File /tmp/MIME2910438175498708242.tmp was not deleted
> > WARNING: The following warnings have been detected: WARNING: Parameter 1
> of
> > type T from public void
> >
> >
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setContextualInstance(T)
> > is not resolvable to a concrete type.
> > WARNING: Parameter 1 of type
> > javax.enterprise.context.spi.CreationalContext<T> from public void
> >
> >
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setCreationalContext(javax.enterprise.context.spi.CreationalContext<T>)
> > is not resolvable to a concrete type.
> >
> > INFO: 20:07:58.082 [http-listener-1(3)] DEBUG
> > o.i.j.deltaspike.EventsITServlet - Responded!
> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> > org.ipd.jeetest.deltaspike.EventsIT - Returned Stream Line:
> EventsITServlet
> > Response
> > INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> > org.ipd.jeetest.deltaspike.EventsIT - Events Observed: false, false,
> false,
> > false, false, false
> >
> >
> >
> > public void onCreate(@Observes @Initialized HttpSession session) {
> > logger.debug("Session created: " + session.getId());
> > }
> > public void onDestroy(@Observes @Destroyed HttpSession session) {
> > logger.debug("Session destroyed: " + session.getId());
> > }
> > public void onRequestCreate(@Observes @Initialized HttpServletRequest
> > request) {
> > logger.debug("Request created: " + request.getRequestURI());
> > }
> > public void onRequestDestroy(@Observes @Destroyed HttpServletRequest
> > request) {
> > logger.debug("Request destroyed: " + request.getRequestURI());
> > }
> > public void onResponseCreate(@Observes @Initialized HttpServletResponse
> > response) {
> > logger.debug("Response created: ");
> > }
> > public void onResponseDestroy(@Observes @Destroyed HttpServletResponse
> > response) {
> > logger.debug("Response destroyed: ");
> > }
> >
>
>
>
> --
> Christian Kaltepoth
> Blog: http://blog.kaltepoth.de/
> Twitter: http://twitter.com/chkal
> GitHub: https://github.com/chkal
>

Re: Request/Session Lifecycle Events and Glassfish 4/Arquillian

Posted by Christian Kaltepoth <ch...@kaltepoth.de>.
Hey Michael,

I'm not aware of any compatibility issues with Glassfish 4. But AFAIK our
integration test suite only runs against Glassfish 3.1. I'll try to find
some time in the next days to add a Glassfish 4 profile to our suite.

Apart from that you could do some debugging just to check if the
corresponding listeners are executed. If they are executed they should also
fire the events. The code isn't very complicated. See [1] and [2].

Christian

[1]
https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java#L53
[2]
https://github.com/apache/deltaspike/blob/master/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventEmitter.java#L47



2013/11/13 Michael Mathers <mi...@gmail.com>

> I can't seem to catch these events.  I am using DS core and the servlet
> module (0.5) and everything else appears to be working fine.  The
> configuration stuff with ProjectStage is great stuff!
>
> I can inject all of the Sevlet objects provided by the DS Servlet module
> but I cannot receive the events.
>
> I created an Arquillian test which pushes over a @WebServlet and then runs
> the test.  The Servlet is initialized by Glassfish and is then called by
> the test via a URL GET and successfully returns a response.  The test gets
> the response but the events are never called.
>
> The web.xml specifies 3.1.  I tried adding all the listeners in anyway and
> it completely blew up (already registered).  Any suggestions?
>
>
> INFO: class: org.apache.deltaspike.servlet.impl.event.EventBridgeFilter
> activated=true
> INFO: 20:07:57.079 [admin-listener(2)] INFO
>  o.i.j.deltaspike.EventsITServlet - EventsITServlet servlet has been
> initialized
> INFO: Loading application [test] at [/collectortest]
> INFO: test was successfully deployed in 2,643 milliseconds.
> INFO: File /tmp/MIME2910438175498708242.tmp was not deleted
> WARNING: The following warnings have been detected: WARNING: Parameter 1 of
> type T from public void
>
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setContextualInstance(T)
> is not resolvable to a concrete type.
> WARNING: Parameter 1 of type
> javax.enterprise.context.spi.CreationalContext<T> from public void
>
> org.apache.deltaspike.core.util.context.ContextualInstanceInfo.setCreationalContext(javax.enterprise.context.spi.CreationalContext<T>)
> is not resolvable to a concrete type.
>
> INFO: 20:07:58.082 [http-listener-1(3)] DEBUG
> o.i.j.deltaspike.EventsITServlet - Responded!
> INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> org.ipd.jeetest.deltaspike.EventsIT - Returned Stream Line: EventsITServlet
> Response
> INFO: 20:07:58.087 [http-listener-1(4)] DEBUG
> org.ipd.jeetest.deltaspike.EventsIT - Events Observed: false, false, false,
> false, false, false
>
>
>
> public void onCreate(@Observes @Initialized HttpSession session) {
> logger.debug("Session created: " + session.getId());
> }
> public void onDestroy(@Observes @Destroyed HttpSession session) {
> logger.debug("Session destroyed: " + session.getId());
> }
> public void onRequestCreate(@Observes @Initialized HttpServletRequest
> request) {
> logger.debug("Request created: " + request.getRequestURI());
> }
> public void onRequestDestroy(@Observes @Destroyed HttpServletRequest
> request) {
> logger.debug("Request destroyed: " + request.getRequestURI());
> }
> public void onResponseCreate(@Observes @Initialized HttpServletResponse
> response) {
> logger.debug("Response created: ");
> }
> public void onResponseDestroy(@Observes @Destroyed HttpServletResponse
> response) {
> logger.debug("Response destroyed: ");
> }
>



-- 
Christian Kaltepoth
Blog: http://blog.kaltepoth.de/
Twitter: http://twitter.com/chkal
GitHub: https://github.com/chkal