users@javaee-spec.java.net

[javaee-spec users] [jsr342-experts] Re: CDI in Application Client Container

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Thu, 15 Nov 2012 11:54:31 +0000

Stuart Douglas just raised these concerns as well:

* Which contexts should be active: I would say just the application context, which is probably not hugely useful (this is the same point Nigel raised).
* The other problem that just occurred to me [Stuart] is that local EJB's are not present in the application client container, so if you have some code that is mean't to run server side, the presence of that code will cause an unsatisfied dep error. In fact the more I think about it the more problematic this seems.

On 13 Nov 2012, at 20:43, Jason Greene wrote:

> Another issue to solve is what we do with static field injection.
>
> On Nov 13, 2012, at 2:38 PM, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:
>
>> What contexts are active? What is the context lifecycle?
>>
>> On 13 Nov 2012 20:27, "Bill Shannon" <bill.shannon_at_oracle.com> wrote:
>> I don't understand why it's hard to solve now.
>>
>> We don't need a portable way to bootstrap CDI. We just need the ACC
>> to use whatever non-portable method it needs for the CDI implementation
>> it's using. As long as CDI is bootstrapped before the application
>> starts, that's fine.
>>
>> Why can't we do that now?
>>
>> Pete Muir wrote on 11/13/12 01:43:
>>> Right, from my perspective as CDI spec lead, this is a mistake in the Java EE spec that was introduced when CDI was added to Java EE 6. The CDI spec unambiguously says that the Application Client Container is not required to be supported by CDI, and the CDI TCK does not test it.
>>>
>>> I'll raise this with the CDI EG and see if they want to support it or not. However, I would certainly vote no at this point. As I expressed, I would prefer to defer to CDI 2.0 when we define Java SE support - this then becomes an easy problem to solve.
>>>
>>> On 12 Nov 2012, at 23:58, Jason Greene wrote:
>>>
>>>> We purposefully did not include support for the app client container in the CDI spec, mainly because it has low usage, there are numerous differences in container implementations, SE support was politically unpopular at the time, and we were waiting to see what happened with modularity.
>>>>
>>>> On Nov 11, 2012, at 2:07 PM, Bill Shannon <bill.shannon_at_oracle.com> wrote:
>>>>
>>>>> Sigh...
>>>>>
>>>>> It appears that we neither implemented nor tested support for CDI in the app client container. Clearly something we'll need to fix for EE 7, if not sooner.
>>>>>
>>>>> Bill Shannon wrote on 11/09/2012 04:47 PM:
>>>>>> Yes, based on the Java EE 6 platform spec, I intended and expected CDI to work in the app client container.
>>>>>>
>>>>>> I'm trying to find out what we actually implemented and tested... :-)
>>>>>>
>>>>>> Antonio Goncalves wrote on 11/09/12 14:10:
>>>>>>> Ok, good to know. But that means that all ACC implementations should support it then ? As Pete said, looks like the JBoss one doesn't....
>>>>>>>
>>>>>>> I found the mail I sent to the GlassFish forum a couple of years ago about this topic (http://www.java.net/forum/topic/glassfish/glassfish/using-cdi-acc-se-environment). I'll be doing more test to make sure and fill a bug if needed.
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Nov 9, 2012 at 10:57 PM, Bill Shannon <bill.shannon_at_oracle.com> wrote:
>>>>>>> CDI is supposed to be supported in the app client container. If it's not working, please file bugs.
>>>>>>>
>>>>>>> Antonio Goncalves wrote on 11/09/12 06:09:
>>>>>>>> Hum.... for me it's just another container (EJB, Servlet & Client) so I would expect the same services from CDI. ACC is not plain Java SE, it's a container that gives you a small set of services, and that includes CDI (as per Java EE specification).
>>>>>>>>
>>>>>>>> Bill/Linda, if CDI is not supported in ACC why not getting rid of it in Figure EE.2-1 ? It's confusing.
>>>>>>>>
>>>>>>>> Antonio
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Nov 9, 2012 at 3:01 PM, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:
>>>>>>>> This also ties in to more general Java SE support for CDI IMO. I would probably prefer to get a general solution sorted, rather than a special case for ACC.
>>>>>>>>
>>>>>>>> On 9 Nov 2012, at 14:56, Antonio Goncalves wrote:
>>>>>>>>
>>>>>>>>> I like to use Producers and Alternatives so I can easily switch context. In the case of having CDI in ACC that would allow me to invoke different Web Serivces just by changing beans.xml
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Nov 9, 2012 at 2:44 PM, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:
>>>>>>>>> It's not in the cdi tck so I doubt it is in jboss as.
>>>>>>>>>
>>>>>>>>> Nigel's point about scopes is very relevant.
>>>>>>>>> On 9 Nov 2012 14:03, "Antonio Goncalves" <antonio.goncalves_at_gmail.com> wrote:
>>>>>>>>> I'm not an ACC expert, but I do use it once in a while. But to be honest, I don't know why it doesn't work. If you look at the EE spec (eg. EE 7 - Figure EE.2-1) you see that CDI & DI is in the ACC. But on the other hand, the CDI 1.0 spec (12.1. Bean archives) says "The container is not required to support application client jar bean archives." I tried several time with the appclient from GlassFish, and CDI just doesn't work (wonder if JBoss ACC allows CDI or not). The "is not required" part is frustrating.
>>>>>>>>>
>>>>>>>>> Antonio
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Nov 9, 2012 at 12:48 PM, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:
>>>>>>>>> I'm not an expert in the ACC, so would need a ACC expert who knows CDI to help us define the behavior. Interested Antonio?
>>>>>>>>>
>>>>>>>>> On 9 Nov 2012, at 12:41, Antonio Goncalves wrote:
>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> Correct me if I'm wrong but I haven't seen any discussion on this topic. In Java EE 6 CDI doesn't work in ACC. Wouldn't it be useful to add it in EE 7 ?
>>>>>>>>>>
>>>>>>>>>> A use case I'm working on at the moment is that I have a Java SE class (running in ACC) that injects a web service reference with @WebServiceRef. With CDI enabled I could produce this reference and just @Inject it.
>>>>>>>>>>
>>>>>>>>>> What do you think ?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Antonio Goncalves
>>>>>>>>>> Software architect and Java Champion
>>>>>>>>>>
>>>>>>>>>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Antonio Goncalves
>>>>>>>>> Software architect and Java Champion
>>>>>>>>>
>>>>>>>>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Antonio Goncalves
>>>>>>>>> Software architect and Java Champion
>>>>>>>>>
>>>>>>>>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Antonio Goncalves
>>>>>>>> Software architect and Java Champion
>>>>>>>>
>>>>>>>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Antonio Goncalves
>>>>>>> Software architect and Java Champion
>>>>>>>
>>>>>>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
>>>>>>
>>>>>
>>>>
>>>
>>
>