[cdi-dev] Extension handling in EARs

Mark Struberg struberg at yahoo.de
Fri Feb 20 02:13:03 EST 2015


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]

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.

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




More information about the cdi-dev mailing list