<div dir="ltr"><br><div dir="ltr">Hi Folks, <br><br>I work in the IBM CDI implementation team. <br><br>We are running the CDI 2.0 TCK/CDS and get a test failure on: <br><br>org.jboss.cdi.tck.tests.<wbr>extensions.lifecycle.broken.<wbr>observerMethod.<wbr>ObserverMethodWithoutNotifyMet<wbr>hodTest <br><br>that I need some advice on. <br><br>The test has:   <br><br>import javax.enterprise.inject.spi.<wbr>DeploymentException; <br>        <br>    @ShouldThrowException(<wbr>DeploymentException.class) <br><br><br>    // unable to process ObserverMethodConfigurator due to missing notify method impl <br>    @Test <br>    @SpecAssertions({ @SpecAssertion(section = AFTER_BEAN_DISCOVERY, id = &quot;ee&quot;) }) <br>    public void unableToProcessObserverMethodC<wbr>onfigurator() { <br>    } <br><br>This behaviour is specified in <br>   <a href="https://docs.jboss.org/cdi/spec/2.0/cdi-spec-with-assertions.html#after_bean_discovery" target="_blank">https://docs.jboss.org/cdi/<wbr>spec/2.0/cdi-spec-with-<wbr>assertions.html#after_bean_<wbr>discovery</a> <br>(search for &quot;ee)&quot; ) <br><br>ee)
 If the container is unable to process the ObserverMethodConfigurator it
 automatically detects the problem and treats it as a deployment 
problem. <br>ObserverMethodWithoutNotifyMet<wbr>hodTest.<wbr>unableToProcessObserverMethodC<wbr>onfigurator()<br><br><br>However
 what we see coming back from Weld is not a javax DeploymentException 
but a javax DefinitionException wrapping a weld DeploymentException 
cause <br><br>Stack Dump = javax.enterprise.inject.spi.<wbr>DefinitionException: org.jboss.weld.exceptions.<wbr>DeploymentException: WELD-000179: ObserverMethodConfigurator created by org.jboss.cdi.tck.tests.<wbr>extensions.lifecycle.broken.<wbr>observerMethod.<wbr>AfterBeanDiscoveryObserver@<wbr>d31423c cannot be processed <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl.<wbr>finish(AfterBeanDiscoveryImpl.<wbr>java:180)                     <wbr>            &lt;&lt;&lt;&lt;&lt;&lt;&lt; Problem???? <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl.<wbr>fire(AfterBeanDiscoveryImpl.<wbr>java:76) <br>        at org.jboss.weld.bootstrap.<wbr>WeldStartup.deployBeans(<wbr>WeldStartup.java:446) <br>        at org.jboss.weld.bootstrap.<wbr>WeldBootstrap.deployBeans(<wbr>WeldBootstrap.java:83) <br>        at com.ibm.ws.cdi.impl.<wbr>CDIContainerImpl.<wbr>startInitialization(<wbr>CDIContainerImpl.java:149) <br>        at com.ibm.ws.cdi.liberty.<wbr>CDIRuntimeImpl.<wbr>applicationStarting(<wbr>CDIRuntimeImpl.java:400) <br>        at com.ibm.ws.container.service.<wbr>state.internal.<wbr>ApplicationStateManager.<wbr>fireStarting(<wbr>ApplicationStateManager.java:<wbr>28) <br>        at com.ibm.ws.container.service.<wbr>state.internal.<wbr>StateChangeServiceImpl.<wbr>fireApplicationStarting(<wbr>StateChangeServiceImpl.java:<wbr>50) <br>        at com.ibm.ws.app.manager.module.<wbr>internal.DeployedAppInfoBase.<wbr>preDeployApp(<wbr>DeployedAppInfoBase.java:383) <br>        at com.ibm.ws.app.manager.module.<wbr>internal.DeployedAppInfoBase.<wbr>deployApp(DeployedAppInfoBase.<wbr>java:412) <br>        at com.ibm.ws.app.manager.war.<wbr>internal.<wbr>WARApplicationHandlerImpl.<wbr>install(<wbr>WARApplicationHandlerImpl.<wbr>java:65) <br>        at com.ibm.ws.app.manager.<wbr>internal.statemachine.<wbr>StartAction.execute(<wbr>StartAction.java:140) <br>        at com.ibm.ws.app.manager.<wbr>internal.statemachine.<wbr>ApplicationStateMachineImpl.<wbr>enterState(<wbr>ApplicationStateMachineImpl.<wbr>java:1258) <br>        at com.ibm.ws.app.manager.<wbr>internal.statemachine.<wbr>ApplicationStateMachineImpl.<wbr>run(<wbr>ApplicationStateMachineImpl.<wbr>java:873) <br>        at java.util.concurrent.<wbr>ThreadPoolExecutor.runWorker(<wbr>ThreadPoolExecutor.java:1149) <br>        at java.util.concurrent.<wbr>ThreadPoolExecutor$Worker.run(<wbr>ThreadPoolExecutor.java:624) <br>        at java.lang.Thread.run(Thread.<wbr>java:748) <br>Caused by: org.jboss.weld.exceptions.<wbr>DeploymentException: WELD-000179: ObserverMethodConfigurator created by org.jboss.cdi.tck.tests.<wbr>extensions.lifecycle.broken.<wbr>observerMethod.<wbr>AfterBeanDiscoveryObserver@<wbr>d31423c cannot be processed <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl$<wbr>ObserverRegistration.<wbr>initObserverMethod(<wbr>AfterBeanDiscoveryImpl.java:<wbr>368) <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl.<wbr>processObserverRegistration(<wbr>AfterBeanDiscoveryImpl.java:<wbr>268) <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl.<wbr>finish(AfterBeanDiscoveryImpl.<wbr>java:177) <br>        ... 16 more <br>Caused by: org.jboss.weld.exceptions.<wbr>DefinitionException:
 WELD-000415: Custom implementation of observer method does not override
 either notify(T) or notify(EventContext&lt;T&gt;): 
org.jboss.weld.bootstrap.<wbr>events.configurator.<wbr>ObserverMethodConfiguratorImpl<wbr>@7e164c01 <br>        at org.jboss.weld.bootstrap.<wbr>events.configurator.<wbr>ObserverMethodConfiguratorImpl<wbr>$ImmutableObserverMethod.&lt;<wbr>init&gt;(<wbr>ObserverMethodConfiguratorImpl<wbr>.java:272) <br>        at org.jboss.weld.bootstrap.<wbr>events.configurator.<wbr>ObserverMethodConfiguratorImpl<wbr>.complete(<wbr>ObserverMethodConfiguratorImpl<wbr>.java:234) <br>        at org.jboss.weld.bootstrap.<wbr>events.AfterBeanDiscoveryImpl$<wbr>ObserverRegistration.<wbr>initObserverMethod(<wbr>AfterBeanDiscoveryImpl.java:<wbr>366) <br>        ... 18 more <br><br><br>We can see the AfterBeanDiscoveryImpl.java:<wbr>180 being <br><br>    /** <br>     * Bean and observer registration is delayed until after all {@link AfterBeanDiscovery} observers are notified. <br>     */ <br>    private void finish() { <br>        try { <br>            GlobalEnablementBuilder globalEnablementBuilder = getBeanManager().getServices()<wbr>.get(GlobalEnablementBuilder.<wbr>class); <br>            for (BeanRegistration registration : additionalBeans) { <br>                processBeanRegistration(<wbr>registration, globalEnablementBuilder); <br>            } <br>            for (ObserverRegistration registration : additionalObservers) { <br>                processObserverRegistration(<wbr>registration); <br>            } <br>        } catch (Exception e) { <br>            throw new DefinitionException(e);     &lt;&lt;&lt;&lt;&lt;&lt;  line 180 <br>        } <br>    } <br><br><br>I am also aware of, in <a href="http://docs.jboss.org/cdi/spec/2.0/cdi-spec.pdf" target="_blank">http://docs.jboss.org/cdi/<wbr>spec/2.0/cdi-spec.pdf</a> 11.5.3., <br>   
 &quot;If any observer method of the AfterBeanDiscovery event throws an 
exception, the exception is treated as a definition error by the 
container&quot; <br><br>So why is the test expecting DeploymentException <br><br>import javax.enterprise.inject.spi.<wbr>DeploymentException; <br>...      @ShouldThrowException(<wbr>DeploymentException.class) <br><br><br>It seems like the test is seeing <br>    @SpecAssertions({ @SpecAssertion(section = AFTER_BEAN_DISCOVERY, id = &quot;ee&quot;) }) <br>       
 If the container is unable to process the ObserverMethodConfigurator it
 automatically detects the problem and treats it as a deployment 
problem. <br>as dominant but the weld implementation is seeing <br>       <a href="http://docs.jboss.org/cdi/spec/2.0/cdi-spec.pdf" target="_blank">http://docs.jboss.org/cdi/<wbr>spec/2.0/cdi-spec.pdf</a>: 11.5.3 <br>      
 If any observer method of the AfterBeanDiscovery event throws an 
exception, the exception is treated as a definition error by the 
container&quot; <br>as dominant. <br><br>....and the two do not agree. <br><br>So the bottom line is the CDI CTS/TCK test <br>    org.jboss.cdi.tck.tests.<wbr>extensions.lifecycle.broken.<wbr>observerMethod.<wbr>ObserverMethodWithoutNotifyMet<wbr>hodTest <br>fails due to the inconsistency. <br><br>Have I missunderstood the spec contradiction or missed some part of Weld integration needed? <br><br>Gordon. </div><br></div>