[jboss-jira] [JBoss JIRA] (WFLY-11373) EE naming context not set when @Initialized(ApplicationScoped.class) event is fired in some cases

Ladislav Thon (Jira) issues at jboss.org
Mon Nov 19 07:53:00 EST 2018


Ladislav Thon created WFLY-11373:
------------------------------------

             Summary: EE naming context not set when @Initialized(ApplicationScoped.class) event is fired in some cases
                 Key: WFLY-11373
                 URL: https://issues.jboss.org/browse/WFLY-11373
             Project: WildFly
          Issue Type: Bug
          Components: CDI / Weld
    Affects Versions: 14.0.1.Final
            Reporter: Ladislav Thon
            Assignee: Matej Novotny


Since [this commit|https://github.com/wildfly/wildfly/commit/3659f4738aa3b08515b93ca3912e5027d40e30ae] (which fixed WFLY-9732), the EE naming context is not set up properly when {{WeldBootstrap.endInitialization()}} is called. This is because the naming context is set up by the {{SetupAction}} executed in {{WeldStartService}}. ({{WeldBootstrap.endInitialization()}} used to be invoked from {{WeldStartService}} as well, but the commit linked above moved the invocation to a separate {{WeldStartCompletionService}}.)

That is a problem because {{endInitialization()}} is where the {{@Initialized(ApplicationScoped.class)}} event is fired from (in some cases). If there's a bean that's being eagerly-initialized by listening for this event and the bean also requires the EE naming context (e.g. for injecting {{@Resource(lookup = "java:comp/DefaultManagedThreadFactory")}}), deployment now fails (because the resource injection fails).

I can see this problem in Thorntail, because the pattern described above is used by SmallRye FaultTolerance (see [HystrixInitializer|https://github.com/smallrye/smallrye-fault-tolerance/blob/master/implementation/src/main/java/io/smallrye/faulttolerance/HystrixInitializer.java#L48] and [DefaultHystrixConcurrencyStrategy|https://github.com/smallrye/smallrye-fault-tolerance/blob/master/implementation/src/main/java/io/smallrye/faulttolerance/DefaultHystrixConcurrencyStrategy.java#L52]).



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list