[cdi-dev] CDI events in .ear packaged application

Sverker Abrahamsson sverker at abrahamsson.com
Tue Nov 29 09:28:27 EST 2016


Thank you, I found the issue.

I was sending the configuration event in method listening to 
AfterDeploymentValidation event, but that is called after 
AfterBeanDiscovery which is where CdiCamelExtension hangs when trying to 
add my RouteBuilders.

When I moved the code for sending out the event to 
CdiCamelExtension.afterBeanDiscovery() then it works like a charm and I 
do receive the event even in my ear packaged application.

/Sverker

Den 2016-11-29 kl. 12:34, skrev Martin Kouba:
> Hi Sverker,
>
> the CDI spec does not define any visibility boundaries for events. So 
> an observer method should be notified if the declaring bean is enabled 
> and the payload type is accessible. I would try to verify these 
> assumptions first (e.g. use debug logging [1] or development mode [2]).
>
> Also do you have a sample app/reproducer?
>
> Martin
>
> [1]
> http://weld.cdi-spec.org/documentation/#7
>
> [2]
> http://weld.cdi-spec.org/news/2016/10/07/tip2-devmode/
>
>
> Dne 29.11.2016 v 12:18 sverker napsal(a):
>> Hi
>> I'm trying to solve an issue with CDI usage in Apache Camel where I was
>> suggested to use CDI Events to configure the context behavior. This 
>> works
>> fine in the testcases packaged as .jar or .war, but when I try to use 
>> it in
>> my application that is packaged as an .ear then it doesn't work. The 
>> event
>> is never received.
>>
>> When I search on this issue it appears to be due to classloader 
>> boundary and
>> that CDI events won't be carried over them. I had a similar problem 
>> before
>> in the application which I solved by using a JMS topic instead but 
>> can't do
>> that now.
>>
>> Anybody knows a way to make CDI events work in an .ear packaged 
>> application
>> deployed on Wildfly 10.1 application server?
>>
>> Link to the ticket for Apache Camel:
>> https://issues.apache.org/jira/browse/CAMEL-10391
>>
>>
>>
>>
>> -- 
>> View this message in context: 
>> http://cdi-development-mailing-list.1064426.n5.nabble.com/CDI-events-in-ear-packaged-application-tp5714171.html
>> Sent from the CDI Development mailing list mailing list archive at 
>> Nabble.com.
>> _______________________________________________
>> 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