You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Antonin Stefanutti (JIRA)" <ji...@apache.org> on 2015/03/11 17:36:39 UTC

[jira] [Updated] (OWB-1040) Lifecycle events fired during bean discovery do not follow specification sequence

     [ https://issues.apache.org/jira/browse/OWB-1040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonin Stefanutti updated OWB-1040:
------------------------------------
    Description: 
The lifecycle events, like {{ProcessInjectionPoint}} and {{ProcessBeanAttributes}} are not fired according to the sequence specified in the [Bean discovery|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_discovery_steps] section of the specification.

Besides, the {{BeanAttributes}} set with the {{ProcessBeanAttributes}} event are accessed directly which contradicts the [{{ProcessBeanAttributes}} event|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#process_bean_attributes] specification:
{quote}
Any observer of this event is permitted to wrap and/or replace the BeanAttributes. The container must use the final value of this property, after all observers have been called, to manage instances of the bean. Changes to BeanAttributes are not propagated to the annotated type from which the bean definition was created.
{quote}

Failing test can be found here:
https://github.com/astefanutti/camel-cdi/blob/a9e94607beaee546f76b7f6e70b9652bf8468d77/envs/se/src/test/java/org/apache/camel/cdi/se/EventEndpointTest.java

The following exception is thrown when executed with OWB (not systematically though maybe due to multi-threading):
{code}
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.apache.camel.cdi.CdiEventEndpoint] is not found with the qualifiers
Qualifiers: [@org.apache.camel.cdi.se.qualifier.BarQualifier()]
for injection into Field Injection Point, field name :  barQualifierCdiEventEndpoint, Bean Owner : [EventConsumingRoute, WebBeansType:MANAGED, Name:null, API Types:[org.apache.camel.builder.RouteBuilder,org.apache.camel.builder.BuilderSupport,org.apache.camel.cdi.se.bean.EventConsumingRoute,java.lang.Object,org.apache.camel.RoutesBuilder], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
{code}
This is not supposed to happen as the missing qualifiers are dynamically added in the Camel CDI extension here: https://github.com/astefanutti/camel-cdi/blob/a9e94607beaee546f76b7f6e70b9652bf8468d77/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L118.

The problem is that OWB calls the observer methods in a different sequence than expected:
{code}
ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.EventEndpointTest$EventObserver
ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiCamelFactory$1
ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiEventComponent
ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.EventEndpointTest
ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiCamelFactory
ProcessBeanAttributes<?>:interface org.apache.camel.Endpoint
ProcessBeanAttributes<T>:interface org.apache.camel.Endpoint
BeanAttributes.getQualifiers()
ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
BeanAttributes.getQualifiers()
ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
BeanAttributes.getQualifiers()
ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
BeanAttributes.getQualifiers()
ProcessBeanAttributes<?>:interface org.apache.camel.TypeConverter
ProcessBeanAttributes<?>:CdiEventEndpoint<T extends  class java.lang.Object>
ProcessBeanAttributes<T>:CdiEventEndpoint<T extends  class java.lang.Object>
BeanAttributes.getQualifiers()
ProcessBeanAttributes<?>:interface org.apache.camel.ProducerTemplate
BeanAttributes.getQualifiers()
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
{code}
For example, the sequence for the {{EventProducingRoute}} bean is:
{code}
ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
{code}
While from the specification, the {{ProcessInjectionPoint}} event must be fired before the {{ProcessBeanAttributes}}. Note that this sequence differs from one run to another.




  was:
The lifecycle events, like {{ProcessInjectionPoint}} and {{ProcessBeanAttributes}} are not fired according to the sequence specified in the [Bean discovery|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_discovery_steps] section of the specification.

Besides, the {{BeanAttributes}} set with the {{ProcessBeanAttributes}} event are accessed directly which contradicts the [{{ProcessBeanAttributes}} event|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#process_bean_attributes] specification:
{quote}
Any observer of this event is permitted to wrap and/or replace the BeanAttributes. The container must use the final value of this property, after all observers have been called, to manage instances of the bean. Changes to BeanAttributes are not propagated to the annotated type from which the bean definition was created.
{quote}

Use case can be found in the [Camel CDI extension|https://github.com/astefanutti/camel-cdi], more precisely:
https://github.com/astefanutti/camel-cdi/blob/6d2bb272ff070e38736a5cef10d113bbd582c95e/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L118



> Lifecycle events fired during bean discovery do not follow specification sequence
> ---------------------------------------------------------------------------------
>
>                 Key: OWB-1040
>                 URL: https://issues.apache.org/jira/browse/OWB-1040
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Lifecycle
>    Affects Versions: 1.5.0
>            Reporter: Antonin Stefanutti
>            Priority: Critical
>
> The lifecycle events, like {{ProcessInjectionPoint}} and {{ProcessBeanAttributes}} are not fired according to the sequence specified in the [Bean discovery|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_discovery_steps] section of the specification.
> Besides, the {{BeanAttributes}} set with the {{ProcessBeanAttributes}} event are accessed directly which contradicts the [{{ProcessBeanAttributes}} event|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#process_bean_attributes] specification:
> {quote}
> Any observer of this event is permitted to wrap and/or replace the BeanAttributes. The container must use the final value of this property, after all observers have been called, to manage instances of the bean. Changes to BeanAttributes are not propagated to the annotated type from which the bean definition was created.
> {quote}
> Failing test can be found here:
> https://github.com/astefanutti/camel-cdi/blob/a9e94607beaee546f76b7f6e70b9652bf8468d77/envs/se/src/test/java/org/apache/camel/cdi/se/EventEndpointTest.java
> The following exception is thrown when executed with OWB (not systematically though maybe due to multi-threading):
> {code}
> org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.apache.camel.cdi.CdiEventEndpoint] is not found with the qualifiers
> Qualifiers: [@org.apache.camel.cdi.se.qualifier.BarQualifier()]
> for injection into Field Injection Point, field name :  barQualifierCdiEventEndpoint, Bean Owner : [EventConsumingRoute, WebBeansType:MANAGED, Name:null, API Types:[org.apache.camel.builder.RouteBuilder,org.apache.camel.builder.BuilderSupport,org.apache.camel.cdi.se.bean.EventConsumingRoute,java.lang.Object,org.apache.camel.RoutesBuilder], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
> {code}
> This is not supposed to happen as the missing qualifiers are dynamically added in the Camel CDI extension here: https://github.com/astefanutti/camel-cdi/blob/a9e94607beaee546f76b7f6e70b9652bf8468d77/impl/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java#L118.
> The problem is that OWB calls the observer methods in a different sequence than expected:
> {code}
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.EventEndpointTest$EventObserver
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiCamelFactory$1
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiEventComponent
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.EventEndpointTest
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.CdiCamelFactory
> ProcessBeanAttributes<?>:interface org.apache.camel.Endpoint
> ProcessBeanAttributes<T>:interface org.apache.camel.Endpoint
> BeanAttributes.getQualifiers()
> ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
> ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
> BeanAttributes.getQualifiers()
> ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
> ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
> BeanAttributes.getQualifiers()
> ProcessBeanAttributes<?>:class org.apache.camel.component.mock.MockEndpoint
> ProcessBeanAttributes<T>:class org.apache.camel.component.mock.MockEndpoint
> BeanAttributes.getQualifiers()
> ProcessBeanAttributes<?>:interface org.apache.camel.TypeConverter
> ProcessBeanAttributes<?>:CdiEventEndpoint<T extends  class java.lang.Object>
> ProcessBeanAttributes<T>:CdiEventEndpoint<T extends  class java.lang.Object>
> BeanAttributes.getQualifiers()
> ProcessBeanAttributes<?>:interface org.apache.camel.ProducerTemplate
> BeanAttributes.getQualifiers()
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventConsumingRoute
> {code}
> For example, the sequence for the {{EventProducingRoute}} bean is:
> {code}
> ProcessBeanAttributes<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> ProcessInjectionPoint<?>:class org.apache.camel.cdi.se.bean.EventProducingRoute
> {code}
> While from the specification, the {{ProcessInjectionPoint}} event must be fired before the {{ProcessBeanAttributes}}. Note that this sequence differs from one run to another.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)