Return-Path: X-Original-To: apmail-openwebbeans-user-archive@www.apache.org Delivered-To: apmail-openwebbeans-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EDD9718FE5 for ; Wed, 2 Mar 2016 13:29:14 +0000 (UTC) Received: (qmail 50610 invoked by uid 500); 2 Mar 2016 13:29:14 -0000 Delivered-To: apmail-openwebbeans-user-archive@openwebbeans.apache.org Received: (qmail 50583 invoked by uid 500); 2 Mar 2016 13:29:14 -0000 Mailing-List: contact user-help@openwebbeans.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@openwebbeans.apache.org Delivered-To: mailing list user@openwebbeans.apache.org Received: (qmail 50573 invoked by uid 99); 2 Mar 2016 13:29:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2016 13:29:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 09DE1C00ED for ; Wed, 2 Mar 2016 13:29:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id nGbJ58vLvrZx for ; Wed, 2 Mar 2016 13:29:12 +0000 (UTC) Received: from mail-ob0-f175.google.com (mail-ob0-f175.google.com [209.85.214.175]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 92A8C5FB70 for ; Wed, 2 Mar 2016 13:29:12 +0000 (UTC) Received: by mail-ob0-f175.google.com with SMTP id rt7so25733039obb.3 for ; Wed, 02 Mar 2016 05:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=dkM9Eyb/6ffM1f5Qi78hDwffY20EfCX3U6gx3MS+2BA=; b=l7yoqWZ3//59+6Gbqr8chwH+rDxg4nLTqTRj1/cSmDnNR3I1a2XGv+dEF7x+r3YToX Of98bPEVWfm1Z6X/jYcIsWKHblkO4Q22cY4VY0DTipz33lFb3LgN6CzHXBhz0773W9Zc SU1pbEkFG7znVGY3R3dj4ebZeCKKt5rzWc3PKPFIp/1fkIGp2NNUuOxLHlUPSRy+y27S qbzisv64M1js98lUrz6/ZDaJmbeu+CcL3NfB0cnR29B9ylZ21/W8zFpJ3+1FT60bc0aq HOyZpbgOcxvhFWtqdR7mnmvgvU9oqNfiPOL92hKaz6vwJlfWv462DINA+tEvl/nNJhnL zWOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=dkM9Eyb/6ffM1f5Qi78hDwffY20EfCX3U6gx3MS+2BA=; b=CYqOJseNfx8f4QcLfWaG5mu/w+HyZ403b9vFn3yP9FGk/hSF4OkyZQ5PNIH4RoFLF+ Bx9cqRaPvPm38BlQkH3ka/cRUusj6HoiZaDIYakazP7kXIs53L6APe7OJ3tka0QyEzP5 Mroj0+MTz48DUg/RCh0U16T2ifOEdWgyXxuTj4cikpmDPZ/4vjPyfLN9MborDqmkaK26 k4KFPJZIH4mlln/trFTJRxRXQcWcoVGXK7kSpUc7/e1gEZAAQEXWQsBSom5JllNtisy1 mF0K49IX7hzdoY7wCdBcFR6pwpKpEkO1jcJ8eZ/Gyrq5SeDNfdeCXXTahd9/+ptGnxZp YTKA== X-Gm-Message-State: AD7BkJLw6zbNtn4HjVV0FM8FMCgbUU0ud/d//mUUlXramAW3g2MpdfCukkm+lOHhsHedELd2HL3WoUZOPxMHjA== MIME-Version: 1.0 X-Received: by 10.182.51.138 with SMTP id k10mr20430020obo.76.1456925351979; Wed, 02 Mar 2016 05:29:11 -0800 (PST) Received: by 10.202.76.136 with HTTP; Wed, 2 Mar 2016 05:29:11 -0800 (PST) In-Reply-To: References: Date: Wed, 2 Mar 2016 14:29:11 +0100 Message-ID: Subject: Re: Nullpointer in WebContextsService From: Thomas Andraschko To: user@openwebbeans.apache.org Content-Type: multipart/alternative; boundary=047d7bfeb70a11bb5b052d10de49 --047d7bfeb70a11bb5b052d10de49 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thats true Romain... We have some code where we need to check if we are running in an http request and not e.g. in a background worker or on startup, to determine if we can take some settings from the user session. As i said, it's no problem if you are checking RequestScoped && SessionScoped. RequestScoepd is not active and therefor the lazyStartSessionContext will not happen. so +0, it was just an idea :) 2016-03-02 14:20 GMT+01:00 Romain Manni-Bucau : > About the log: originally it was not there and it is a nightmare to > understand OWB is not well setup in your container. The log shouldn't > happear - as much as you shouldn't even try to use session scope in a > thread where it is not available theorically. A consensus can be to log i= t > once but in "big" (like taking 20 lines of logs just to say something is > not correct). A step further can be to return a fake context never active > in such cases. > > Wydt? > > > Romain Manni-Bucau > @rmannibucau | Blog > | Github > | LinkedIn > | Tomitriber > > > 2016-03-02 13:56 GMT+01:00 Thomas Andraschko > : > >> The method in deltaspike is ok, it just checks if the context is active >> in the current thread. >> >> +1 for jira and a patch. >> >> 2016-03-02 13:47 GMT+01:00 Karl Kild=C3=A9n : >> >>> Right, Deltaspike hides the ugly that you call a boolean method but >>> instead of false you get ContextNotActiveException. One of the more >>> mystical parts of the specification if you ask me. Maybe you are refere= eing >>> to how the BeanManager should behave if the thread is not managed? >>> >>> It is simply a little bit over my head but at least nothing in the >>> javadoc for ContextUtils in deltaspike forbids usage from unmanaged thr= eads >>> and frankly if that was a requirement it seems like a poor idea to offe= r >>> such static methods in the first place since managed threads have >>> injectionpoints. >>> >>> Regarding a JIRA och a patch: I will take care of it. >>> >>> Thanks for helping me understanding this better >>> >>> cheers / Kalle >>> >> >> > --047d7bfeb70a11bb5b052d10de49 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thats true Romain...

We h= ave some code where we need to check if we are running in an http request a= nd not e.g. in a background worker or on startup, to determine if we can ta= ke some settings from the user session.

As i said, it= 9;s no problem if you are checking RequestScoped && SessionScoped. = RequestScoepd is not active and therefor the lazyStartSessionContext wi= ll not happen.

so +0, it was just an idea :)

2016-03= -02 14:20 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com><= /span>:
About the log: o= riginally it was not there and it is a nightmare to understand OWB is not w= ell setup in your container. The log shouldn't happear - as much as you= shouldn't even try to use session scope in a thread where it is not av= ailable theorically. A consensus can be to log it once but in "big&quo= t; (like taking 20 lines of logs just to say something is not correct). A s= tep further can be to return a fake context never active in such cases.
Wydt?

<= div dir=3D"ltr">

Romain Manni-Bucau
@rmannibucau | =C2=A0Blog=C2=A0| Github=C2=A0| LinkedIn=C2=A0| Tomitriber
<= /div>

2016-03-02 13:= 56 GMT+01:00 Thomas Andraschko <andraschko.thomas@gmail.com&= gt;:
The met= hod in deltaspike is ok, it just checks if the context is active in the cur= rent thread.

+1 for jira and a patch.

2016-03-02 13:47 GMT+0= 1:00 Karl Kild=C3=A9n <karl.kilden@gmail.com>:
Right, Deltaspike hides the ugly = that you call a boolean method but instead of false you get=C2=A0ContextNot= ActiveException. One of the more mystical parts of the specification if you= ask me. Maybe you are refereeing to how the BeanManager should behave if t= he thread is not managed?

It is simply a little bit over= my head but at least nothing in the javadoc for=C2=A0ContextUtils in delta= spike forbids usage from unmanaged threads and frankly if that was a requir= ement it seems like a poor idea to offer such static methods in the first p= lace since managed threads have injectionpoints.

R= egarding a JIRA och a patch: I will take care of it.

Thanks for helping me understanding this better=C2=A0

cheers / Kalle



--047d7bfeb70a11bb5b052d10de49--