You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Lars-Fredrik Smedberg <it...@gmail.com> on 2014/05/07 10:42:47 UTC

WAS and Application Context during @Asynchronous EJB method calls

Hi!

We are using Websphere (right now Liberty Profile April Beta since we use
Liberty Profile in development and need the async EJB functionality) to
test CDI, EJB and @Asynchronous method calls.

The scenario is the folowing:

1. An @ApplicationScoped bean is configured by an Event fired by
RequestContextListener (we could not fire the event from a
ServletContextListener, more on that in another post).
2. I have debugged and can see that the event reaches the
@ApplicationScoped bean and it gets initialized.
3. The @Asynchronous method on the EJB injects and uses the
@ApplicationScoped bean BUT the contextual instance is NOT the same as the
one in 2 above (and its therefore not initialized properly).

If I remove the @Asynchronous annotation from the EJB method and re-run the
scenario above everything works fine (the contextual instance of the
@ApplicationScoped bean is the same).

I see in 6.7.3 of the CDI 1.0 specification (1.0 since we use WAS) that the
Application context should be shared and the @Asynchronous scenario above
should work.

Did I misunderstand something or is this a bug that we should report to IBM?

Regards
Lars-Fredrik



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: WAS and Application Context during @Asynchronous EJB method calls

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
I think we have that but will double check to make sure.

I will post more info when/if we open an PMR.

Regards
Lars-Fredrik
On May 14, 2014 9:06 PM, "Mark Struberg" <st...@yahoo.de> wrote:

> Just to make sure the obvious WAS 'specials' are properly worked around:
>
> * you have a WEB-INF/beans.xml ? This caused huge problems in WAS-8 and
> 8.5 if not there
>
> LieGrue,
> strub
>
>   On Wednesday, 14 May 2014, 9:41, Lars-Fredrik Smedberg <
> itsmeden@gmail.com> wrote:
>
> Hi Mark
>
> We are investigating this further and will most likely open a PMR for it.
>
> I have tried it in TomEE without seeing the same problems and we did debug
> into the application scoped bean as you described.
>
> We still have not fully isolated when this problem occurs (and therefor
> not yet opened a PMR), it seems like it can depend on what other types of
> components are packaged in the same ear/war.
>
>
> Thanks for your reply
> Regards
> Lars-Fredrik
>
>
>
>
> On Wed, May 14, 2014 at 9:14 AM, Mark Struberg <st...@yahoo.de> wrote:
>
> This must be the same contextual instance behind in both scenarios.
> I guess you debugged into the ApplicationScoped bean (e.g. into a getter)
> and verified it that way and did not only look at the proxy (which never
> gets fully initialized).
>
> If you really did look at the Contextual Instance and not only at the
> proxy, and if you did get two separate instances then this is really a
> failure which you should open a PMR for.
>
> LieGrue,
> strub
>
>   On Wednesday, 14 May 2014, 4:39, Lars-Fredrik Smedberg <
> itsmeden@gmail.com> wrote:
>
> Hi!
>
> We are using Websphere (right now Liberty Profile April Beta since we use
> Liberty Profile in development and need the async EJB functionality) to
> test CDI, EJB and @Asynchronous method calls.
>
> The scenario is the folowing:
>
> 1. An @ApplicationScoped bean is configured by an Event fired by
> RequestContextListener (we could not fire the event from a
> ServletContextListener, more on that in another post).
> 2. I have debugged and can see that the event reaches the
> @ApplicationScoped bean and it gets initialized.
> 3. The @Asynchronous method on the EJB injects and uses the
> @ApplicationScoped bean BUT the contextual instance is NOT the same as the
> one in 2 above (and its therefore not initialized properly).
>
> If I remove the @Asynchronous annotation from the EJB method and re-run
> the scenario above everything works fine (the contextual instance of the
> @ApplicationScoped bean is the same).
>
> I see in 6.7.3 of the CDI 1.0 specification (1.0 since we use WAS) that
> the Application context should be shared and the @Asynchronous scenario
> above should work.
>
> Did I misunderstand something or is this a bug that we should report to
> IBM?
>
> Regards
> Lars-Fredrik
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>
>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>
>
>

Re: WAS and Application Context during @Asynchronous EJB method calls

Posted by Mark Struberg <st...@yahoo.de>.
Just to make sure the obvious WAS 'specials' are properly worked around:

* you have a WEB-INF/beans.xml ? This caused huge problems in WAS-8 and 8.5 if not there

LieGrue,
strub


On Wednesday, 14 May 2014, 9:41, Lars-Fredrik Smedberg <it...@gmail.com> wrote:
 
Hi Mark
>
>
>We are investigating this further and will most likely open a PMR for it.
>
>
>I have tried it in TomEE without seeing the same problems and we did debug into the application scoped bean as you described.
>
>
>We still have not fully isolated when this problem occurs (and therefor not yet opened a PMR), it seems like it can depend on what other types of components are packaged in the same ear/war.
>
>
>
>
>Thanks for your reply
>Regards
>Lars-Fredrik
>
>
>
>
>
>
>
>On Wed, May 14, 2014 at 9:14 AM, Mark Struberg <st...@yahoo.de> wrote:
>
>This must be the same contextual instance behind in both scenarios. 
>>
>>I guess you debugged into the ApplicationScoped bean (e.g. into a getter) and verified it that way and did not only look at the proxy (which never gets fully initialized).
>>
>>
>>If you really did look at the Contextual Instance and not only at the proxy, and if you did get two separate instances then this is really a failure which you should open a PMR for.
>>
>>
>>
>>LieGrue,
>>strub
>>
>>
>>On Wednesday, 14 May 2014, 4:39, Lars-Fredrik Smedberg <it...@gmail.com> wrote:
>> 
>>Hi!
>>>
>>>
>>>We are using Websphere (right now Liberty Profile April Beta since we use Liberty Profile in development and need the async EJB functionality) to test CDI, EJB and @Asynchronous method calls.
>>>
>>>
>>>The scenario is the folowing:
>>>
>>>
>>>1. An @ApplicationScoped bean is configured by an Event fired by RequestContextListener (we could not fire the event from a ServletContextListener, more on that in another post).
>>>2. I have debugged and can see that the event reaches the @ApplicationScoped bean and it gets initialized.
>>>3. The @Asynchronous method on the EJB injects and uses the @ApplicationScoped bean BUT the contextual instance is NOT the same as the one in 2 above (and its therefore not initialized properly).
>>>
>>>
>>>If I remove the @Asynchronous annotation from the EJB method and re-run the scenario above everything works fine (the contextual instance of the @ApplicationScoped bean is the same).
>>>
>>>
>>>I see in 6.7.3 of the CDI 1.0 specification (1.0 since we use WAS) that the Application context should be shared and the @Asynchronous scenario above should work.
>>>
>>>
>>>Did I misunderstand something or is this a bug that we should report to IBM?
>>>
>>>
>>>Regards
>>>Lars-Fredrik
>>>
>>>
>>>
>>>
>>>
>>>-- 
>>>Med vänlig hälsning / Best regards
>>>
>>>Lars-Fredrik Smedberg
>>>
>>>STATEMENT OF CONFIDENTIALITY:
>>>The information contained in this electronic message and any
>>>attachments to this message are intended for the exclusive use of the
>>>address(es) and may contain confidential or privileged information. If
>>>you are not the intended recipient, please notify Lars-Fredrik Smedberg
>>>immediately at itsmeden@gmail.com, and destroy all copies of this 
>>>message and any attachments. 
>>>
>>>
>
>
>
>-- 
>Med vänlig hälsning / Best regards
>
>Lars-Fredrik Smedberg
>
>STATEMENT OF CONFIDENTIALITY:
>The information contained in this electronic message and any
>attachments to this message are intended for the exclusive use of the
>address(es) and may contain confidential or privileged information. If
>you are not the intended recipient, please notify Lars-Fredrik Smedberg
>immediately at itsmeden@gmail.com, and destroy all copies of this 
>message and any attachments. 
>
>

Re: WAS and Application Context during @Asynchronous EJB method calls

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
Hi Mark

We are investigating this further and will most likely open a PMR for it.

I have tried it in TomEE without seeing the same problems and we did debug
into the application scoped bean as you described.

We still have not fully isolated when this problem occurs (and therefor not
yet opened a PMR), it seems like it can depend on what other types of
components are packaged in the same ear/war.


Thanks for your reply
Regards
Lars-Fredrik




On Wed, May 14, 2014 at 9:14 AM, Mark Struberg <st...@yahoo.de> wrote:

> This must be the same contextual instance behind in both scenarios.
> I guess you debugged into the ApplicationScoped bean (e.g. into a getter)
> and verified it that way and did not only look at the proxy (which never
> gets fully initialized).
>
> If you really did look at the Contextual Instance and not only at the
> proxy, and if you did get two separate instances then this is really a
> failure which you should open a PMR for.
>
> LieGrue,
> strub
>
>   On Wednesday, 14 May 2014, 4:39, Lars-Fredrik Smedberg <
> itsmeden@gmail.com> wrote:
>
> Hi!
>
> We are using Websphere (right now Liberty Profile April Beta since we use
> Liberty Profile in development and need the async EJB functionality) to
> test CDI, EJB and @Asynchronous method calls.
>
> The scenario is the folowing:
>
> 1. An @ApplicationScoped bean is configured by an Event fired by
> RequestContextListener (we could not fire the event from a
> ServletContextListener, more on that in another post).
> 2. I have debugged and can see that the event reaches the
> @ApplicationScoped bean and it gets initialized.
> 3. The @Asynchronous method on the EJB injects and uses the
> @ApplicationScoped bean BUT the contextual instance is NOT the same as the
> one in 2 above (and its therefore not initialized properly).
>
> If I remove the @Asynchronous annotation from the EJB method and re-run
> the scenario above everything works fine (the contextual instance of the
> @ApplicationScoped bean is the same).
>
> I see in 6.7.3 of the CDI 1.0 specification (1.0 since we use WAS) that
> the Application context should be shared and the @Asynchronous scenario
> above should work.
>
> Did I misunderstand something or is this a bug that we should report to
> IBM?
>
> Regards
> Lars-Fredrik
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>
>
>


-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: WAS and Application Context during @Asynchronous EJB method calls

Posted by Mark Struberg <st...@yahoo.de>.
This must be the same contextual instance behind in both scenarios. 

I guess you debugged into the ApplicationScoped bean (e.g. into a getter) and verified it that way and did not only look at the proxy (which never gets fully initialized).

If you really did look at the Contextual Instance and not only at the proxy, and if you did get two separate instances then this is really a failure which you should open a PMR for.


LieGrue,
strub


On Wednesday, 14 May 2014, 4:39, Lars-Fredrik Smedberg <it...@gmail.com> wrote:
 
Hi!
>
>
>We are using Websphere (right now Liberty Profile April Beta since we use Liberty Profile in development and need the async EJB functionality) to test CDI, EJB and @Asynchronous method calls.
>
>
>The scenario is the folowing:
>
>
>1. An @ApplicationScoped bean is configured by an Event fired by RequestContextListener (we could not fire the event from a ServletContextListener, more on that in another post).
>2. I have debugged and can see that the event reaches the @ApplicationScoped bean and it gets initialized.
>3. The @Asynchronous method on the EJB injects and uses the @ApplicationScoped bean BUT the contextual instance is NOT the same as the one in 2 above (and its therefore not initialized properly).
>
>
>If I remove the @Asynchronous annotation from the EJB method and re-run the scenario above everything works fine (the contextual instance of the @ApplicationScoped bean is the same).
>
>
>I see in 6.7.3 of the CDI 1.0 specification (1.0 since we use WAS) that the Application context should be shared and the @Asynchronous scenario above should work.
>
>
>Did I misunderstand something or is this a bug that we should report to IBM?
>
>
>Regards
>Lars-Fredrik
>
>
>
>
>
>-- 
>Med vänlig hälsning / Best regards
>
>Lars-Fredrik Smedberg
>
>STATEMENT OF CONFIDENTIALITY:
>The information contained in this electronic message and any
>attachments to this message are intended for the exclusive use of the
>address(es) and may contain confidential or privileged information. If
>you are not the intended recipient, please notify Lars-Fredrik Smedberg
>immediately at itsmeden@gmail.com, and destroy all copies of this 
>message and any attachments. 
>
>