Hi guys, I have retrieved some extra logging from the Bootstrap and BootstrapTracker, see below. We noticed we never got the `beanIdentifierIndexBuilt`-logging and after looking into it we suspect the identifier index gets built for an empty list of beans because WeldStartup only lists SessionScoped and ConversationScoped beans (see `WeldStartup#getBeansForBeanIdentifierIndex`) so the race condition happens in the
if (beans.isEmpty()) { |
index = new BeanIdentifier[0]; |
reverseIndex = Collections.emptyMap(); |
indexHash = 0; |
return; |
}
|
between the setting of the index and the setting of the reverseIndex Relevant part of the logging:
2018-05-14 07:46:38,400 INFO [nl.topicus.cobra.liquibase.UpdateNotifier] (ServerService Thread Pool -- 67) Update finished |
2018-05-14 07:46:38,422 DEBUG [org.jboss.weld.BootstrapTracker] (MSC service thread 1-3) START bootstrap > endInitialization |
2018-05-14 07:46:38,451 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) EE modules: [BeanDeploymentModule [id=deployment.keyhub-ear.ear.keyhub-dao.jar, web=false, managers=org.jboss.weld.util.collections.Iterables$$Lambda$837/2129654567@4111074], BeanDeploymentModule [id=deployment.keyhub-ear.ear, web=false, managers=org.jboss.weld.util.collections.Iterables$$Lambda$837/2129654567@1680a122], BeanDeploymentModule [id=deployment.keyhub-ear.ear.keyhub-rest.war, web=true, managers=org.jboss.weld.util.collections.Iterables$$Lambda$837/2129654567@7e56c4c3], BeanDeploymentModule [id=BeanDeploymentModules.DEFAULT, web=false, managers=org.jboss.weld.util.collections.Iterables$$Lambda$837/2129654567@4f99027]] |
2018-05-14 07:46:38,454 DEBUG [org.jboss.weld.BootstrapTracker] (MSC service thread 1-3) END bootstrap > endInitialization (32 ms) |
2018-05-14 07:46:38,454 DEBUG [org.jboss.weld.BootstrapTracker] (MSC service thread 1-3) END bootstrap (24091 ms) |
2018-05-14 07:46:38,457 ERROR [org.jboss.as.ejb3.invocation] (ServerService Thread Pool -- 65) WFLYEJB0034: EJB Invocation failed on component AccountDirectoryService for method public void nl.topicus.keyhub.rest.directory.AccountDirectoryService.initDirectories(): javax.ejb.EJBException: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
|
That UpdateNotifier is part of an @Startup bean. The exception at the end is where the NPE happens. Nowhere in our log do we get the "Bean identifier index built" message, which is consistent with WeldStartup passing an empty list to `BeanIdentifierIndex#build(...)`. |