[weld-dev] Weld Probe not initalized during AfterDeploymentValidation

Matej Novotny manovotn at redhat.com
Mon Aug 13 04:39:33 EDT 2018


Hi Benjamin,

I haven't managed to reproduce this on WildFly, it seems to be working just fine, albeit by chance as ordering is 'random' without priority.

Would you mind giving the fix a spin and tell me if it works for you? Better safe than sorry :-)

The PR is here - https://github.com/weld/core/pull/1866
(and Weld issue is https://issues.jboss.org/browse/WELD-2524 if I haven't mentioned that previously)

Regards
Matej

----- Original Message -----
> From: "Matej Novotny" <manovotn at redhat.com>
> To: "Benjamin Confino" <BENJAMIC at uk.ibm.com>
> Cc: weld-dev at lists.jboss.org, "Tom Evans" <TEVANS at uk.ibm.com>, "Emily Jiang" <EMIJIANG at uk.ibm.com>
> Sent: Tuesday, August 7, 2018 12:45:34 PM
> Subject: Re: [weld-dev] Weld Probe not	initalized	during	AfterDeploymentValidation
> 
> Actually, in CDI 2.0 you can use @Priority to order observer methods - we
> could add @Priority(0) to ProbeExtension to ensure it goes first and avoid
> such possible clashes.
> 
> As for temporary workaround, you can exclude FacesConfigBeanHolder (the
> invoked bean) from monitoring to avoid triggering Probe too early.
> You can do that via `org.jboss.weld.probe.invocationMonitor.excludeType`
> property as described in Weld docs -
> http://docs.jboss.org/weld/reference/latest-master/en-US/html_single/#config-dev-mode
> 
> Matej
> 
> 
> ----- Original Message -----
> > From: "Matej Novotny" <manovotn at redhat.com>
> > To: "Benjamin Confino" <BENJAMIC at uk.ibm.com>
> > Cc: "Emily Jiang" <EMIJIANG at uk.ibm.com>, "Tom Evans" <TEVANS at uk.ibm.com>,
> > weld-dev at lists.jboss.org
> > Sent: Tuesday, August 7, 2018 12:15:41 PM
> > Subject: Re: [weld-dev] Weld Probe not initalized	during
> > 	AfterDeploymentValidation
> > 
> > Hi Benjamin,
> > 
> > CDI spec allows you to inject BM as a method parameter in an extension.
> > There are only limitations on what methods you can/cannot invoke on BM
> > object
> > in certain point during bootstrap (e.g. in certain observer methods).
> > Those should be covered here -
> > http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#beanmanager
> > In short, their extension seems to be legit.
> > 
> > What appears to be the case is that AfterDeploymentValidation observer in
> > MyFaces extension is invoked before one in ProbeExtension (which declares
> > probe as ready).
> > There is no standard way in which we could enforce extension ordering, at
> > least none that I can think of now. But it would make sense to ensure Probe
> > goes first for it to work properly.
> > We should try to reproduce this with WFLY and myfaces (I think we only test
> > mojarra now), it is possible we will be seeing the error as well.
> > 
> > We'll look into what could be done here and will keep you posted.
> > 
> > Matej
> > 
> > ----- Original Message -----
> > > From: "Benjamin Confino" <BENJAMIC at uk.ibm.com>
> > > To: weld-dev at lists.jboss.org
> > > Cc: "Tom Evans" <TEVANS at uk.ibm.com>, "Emily Jiang" <EMIJIANG at uk.ibm.com>
> > > Sent: Tuesday, August 7, 2018 11:31:39 AM
> > > Subject: [weld-dev] Weld Probe not initalized during
> > > 	AfterDeploymentValidation
> > > 
> > > Hello
> > > 
> > > I've been seeing probe not initalized exceptions that occur on CDI 2.0
> > > but
> > > not CDI 1.2, from what I can see when I debug into the issue the problem
> > > occurs in
> > > TransactionalObserverNotifier(ObserverNotifier).notifySyncObservers
> > > 
> > > In CDI 1.2 I see that the the ArrayList observers has two entries, the
> > > first
> > > being ProbeExtension.afterDeploymentValidation
> > > 
> > > In CDI 2.0 I see four entries, with the first being
> > > org.apache.myfaces.cdi.config.FacesConfigExtension
> > > 
> > > And when the afterDeploymentValidation method of FacesConfigExtension is
> > > called the result is org.jboss.weld.exceptions.IllegalStateException:
> > > PROBE-000005: Probe is not properly initialized. I've attached a stack
> > > from
> > > that error:
> > > 
> > > 
> > > And the source is on github:
> > > https://github.com/apache/myfaces/blob/master/impl/src/main/java/org/apache/myfaces/cdi/config/FacesConfigExtension.java
> > > 
> > > So what are the options here? I don't see anything under
> > > http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#after_deployment_validation
> > > saying that you shouldn't invoke beans during after deployment validation
> > > observers. A bit earlier in 11.5 it says "If other beans are injected
> > > into
> > > an extension’s observer methods, non-portable behavior results" but it's
> > > not
> > > clear if that refers to using the injected bean manager to lookup a bean.
> > > 
> > > Presumably if weld-probe needs to run first there's some code to ensure
> > > it
> > > does? Do we need to do something to integrate with that code, or avoid
> > > integrating myfaces?
> > > 
> > > Regards
> > > Benjamin
> > > Unless stated otherwise above:
> > > IBM United Kingdom Limited - Registered in England and Wales with number
> > > 741598.
> > > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
> > > 3AU
> > > 
> > > _______________________________________________
> > > weld-dev mailing list
> > > weld-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/weld-dev
> > 
> > _______________________________________________
> > weld-dev mailing list
> > weld-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/weld-dev
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev



More information about the weld-dev mailing list