BeanManager method getBeans() is not available during application
initialization
--------------------------------------------------------------------------------
Key: WFLY-4579
URL:
https://issues.jboss.org/browse/WFLY-4579
Project: WildFly
Issue Type: Bug
Components: CDI / Weld
Affects Versions: 8.2.0.Final
Environment: Windows 7
Reporter: Thomas Meyer
Assignee: Stuart Douglas
Fix For: 9.0.0.CR2, 10.0.0.Alpha1
Deployment of an EAR fails because of this exception:
09:34:30,854 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002:
Processing weld deployment Project-ejb.jar
09:34:30,862 INFO
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC
service thread 1-2) JNDI bindings for session bean named ModelContext in deployment unit
subdeployment "Project-ejb.jar" of deployment
"Project-ear-0.1.0-SNAPSHOT.ear" are as follows:
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/ModelContext!simulator.ModelContext
java:app/Project-ejb/ModelContext!simulator.ModelContext
java:module/ModelContext!simulator.ModelContext
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/ModelContext
java:app/Project-ejb/ModelContext
java:module/ModelContext
09:34:30,863 INFO
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC
service thread 1-2) JNDI bindings for session bean named AccountsBean in deployment unit
subdeployment "Project-ejb.jar" of deployment
"Project-ear-0.1.0-SNAPSHOT.ear" are as follows:
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/AccountsBean!simulator.AccountsBean
java:app/Project-ejb/AccountsBean!simulator.AccountsBean
java:module/AccountsBean!simulator.AccountsBean
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/AccountsBean
java:app/Project-ejb/AccountsBean
java:module/AccountsBean
09:34:30,864 INFO
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC
service thread 1-2) JNDI bindings for session bean named ContactsBean in deployment unit
subdeployment "Project-ejb.jar" of deployment
"Project-ear-0.1.0-SNAPSHOT.ear" are as follows:
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/ContactsBean!simulator.ContactsBean
java:app/Project-ejb/ContactsBean!simulator.ContactsBean
java:module/ContactsBean!simulator.ContactsBean
java:global/Project-ear-0.1.0-SNAPSHOT/Project-ejb/ContactsBean
java:app/Project-ejb/ContactsBean
java:module/ContactsBean
09:34:30,892 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016002:
Processing weld deployment Project-webapp.war
09:34:30,954 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005:
Starting Services for CDI deployment: Project-ear-0.1.0-SNAPSHOT.ear
09:34:31,016 INFO [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.2.6
(Final)
09:34:31,169 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016008:
Starting weld service for deployment Project-ear-0.1.0-SNAPSHOT.ear
09:34:32,203 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service
thread 1-1) Mojarra 2.2.8-jbossorg-1 20140822-1131 f³r Kontext '/v1' wird
initialisiert.
09:34:33,738 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service
thread 1-1) Critical error during deployment: :
org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager method
getBeans() is not available during application initialization
at
org.jboss.weld.bean.builtin.BeanManagerProxy.checkContainerState(BeanManagerProxy.java:246)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at
org.jboss.weld.bean.builtin.BeanManagerProxy.checkContainerState(BeanManagerProxy.java:251)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at
org.jboss.weld.bean.builtin.BeanManagerProxy.getBeans(BeanManagerProxy.java:100)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at
com.sun.faces.application.JavaFlowLoaderHelper.loadFlows(JavaFlowLoaderHelper.java:66)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:298)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
[jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
at
com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2190)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:296)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:294)
[wildfly-jsf-injection-8.2.0.Final.jar:8.2.0.Final]
at
com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:692)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:260)
[jsf-impl-2.2.8-jbossorg-1.jar:]
at
io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
[undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at
io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193)
[undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_31]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
09:34:33,938 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001:
Failed to start service jboss.undertow.deployment.default-server.default-host./v1:
org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./v1: Failed to start service
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_31]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager method
getBeans() is not available during application initialization
at
io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:222)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
Caused by: java.lang.RuntimeException: org.jboss.weld.exceptions.IllegalStateException:
WELD-001332: BeanManager method getBeans() is not available during application
initialization
at
com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:280)
at
io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
at
io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193)
... 7 more
Caused by: org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager
method getBeans() is not available during application initialization
at
org.jboss.weld.bean.builtin.BeanManagerProxy.checkContainerState(BeanManagerProxy.java:246)
at
org.jboss.weld.bean.builtin.BeanManagerProxy.checkContainerState(BeanManagerProxy.java:251)
at
org.jboss.weld.bean.builtin.BeanManagerProxy.getBeans(BeanManagerProxy.java:100)
at
com.sun.faces.application.JavaFlowLoaderHelper.loadFlows(JavaFlowLoaderHelper.java:66)
at
com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:298)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at
com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2190)
at
com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
at
com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:296)
at
org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:294)
at
com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:692)
at
com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:260)
... 9 more
09:34:34,099 ERROR [org.jboss.as.controller.management-operation]
(DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed -
address: ([("deployment" => "Project-ear-0.1.0-SNAPSHOT.ear")]) -
failure description: {"JBAS014671: Failed services" =>
{"jboss.undertow.deployment.default-server.default-host./v1" =>
"org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./v1: Failed to start service
Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager method
getBeans() is not available during application initialization
Caused by: java.lang.RuntimeException:
org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager method
getBeans() is not available during application initialization
Caused by: org.jboss.weld.exceptions.IllegalStateException: WELD-001332: BeanManager
method getBeans() is not available during application initialization"}}
09:34:34,188 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559:
Deployed "Project-ear-0.1.0-SNAPSHOT.ear" (runtime-name :
"Project-ear-0.1.0-SNAPSHOT.ear")
09:34:34,188 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774:
Service status report
JBAS014777: Services which failed to start:
service jboss.undertow.deployment.default-server.default-host./v1:
org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./v1: Failed to start service
The EAR contains:
1.) An EJB JAR
2.) An WepApp WAR
The webapp uses JSF and JAX-RS.
None of our code seesm to be involved.
The EAR can succesfully deployet on an Weblogic AS.
When I start the WildFly AS with --debug mode and halt at BeanManagerProxy.getBeans() and
directly continue the thread exectuion. the deployment of the EAR file works correctly.
Feels like some race condition..
Any ideas how to fix this?