[cdi-dev] Extension handling in EARs

Jozef Hartinger jharting at redhat.com
Fri Feb 20 03:28:09 EST 2015


On 02/20/2015 08:13 AM, Mark Struberg wrote:
> I’ve now extracted my sample to as smallish as possible.
>
> You can find it on my github repo:
>
> https://github.com/struberg/cdi-ear-test
>
>
> As already explained Wildfly does badly blow up if you use Extensions:
>
> 07:59:44,121 INFO  [at.struct.cdieartest.util.BaseLoggingExtension] (MSC service thread 1-4) processAnnotatedType
> Extension Instance: at.struct.cdieartest.war1.War1Extension at 2b8e6a22
> ThreadContextClassLoader = ModuleClassLoader for Module "deployment.ear-1.0-SNAPSHOT.ear:main" from Service Module Loader
> Object ClassLoader = ModuleClassLoader for Module "deployment.ear-1.0-SNAPSHOT.ear.war2.war:main" from Service Module Loader
> params = [at.struct.cdieartest.war2.War2SampleBean]
Which part is the "bad blow up"?
>
> Explanation: a bean from war2 (War2SampleBean) gets posted to the Extension from war1 (War1Extension).
>
> I did not add more code to keep the sample really clean. But I guess you agree that this will cause ClassNotFound, cannot cast, etc down the road.
No, this will not cause ClassNotFound nor LinkageError as explained in 
my previous reply. I agree with you that we should revisit observer 
resolution rules but let's make sure we back that up by arguments that 
are valid.
>
> Oh, and I don’t think other containers do much better.
> I know that TomEE-1.7.2-SNAPSHOT and 2.0.0-SNAPSHOT do work, but it’s very strict isolation might possibly cause other implications down the road (although much easier to handle ones).
> Can anybody test how GlassFish-3.1 and 4.0 (RI) behaves? Not that I care much about how the RI behaves in this unspecified case - but still good to know ;)
>
>
> LieGrue,
> strub
>
>
>
>> Am 19.02.2015 um 22:28 schrieb Romain Manni-Bucau <rmannibucau at gmail.com>:
>>
>> yep what's I meant by logical (technically we an do all we want)
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2015-02-19 21:10 GMT+01:00 Mark Struberg <struberg at yahoo.de>:
>>> +1
>>> It’s not only logical, it’s really technically crucial.
>>>
>>> Say in war1 you call
>>>
>>> beanManager.fire(new ClassWhichOnlyExistsInWar1());
>>>
>>> and get this event in war2 where it gets observd (maybe due to a super type or interface). This will just blow up your application.
>>> That’s broken, broken, broken.
>>>
>>> LieGrue,
>>> strub
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.



More information about the cdi-dev mailing list