4 Replies Latest reply on Apr 12, 2014 12:16 AM by 天龙 胡

    beans.xml missing -> very strange Exceptions

    Dirk Haase Newbie

      Hi,

       

      I'm using WildFly 8 and I have an ear with 2 war files none of which use JSF. One of them was for REST services, but the initial version was still missing the beans.xml due to an error of mine.

      I could deploy this well without any error. But when I would rebuild it and redeploy, I would get following error:

       

      14:04:05,775 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Critical error during deployment: : org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type

      javax.faces.flow.builder.FlowDefinition

              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:680) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

              at org.jboss.weld.util.ForwardingBeanManager.getContext(ForwardingBeanManager.java:181) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]

              at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.loadFlows(ApplicationAssociate.java:323) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:303) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108) [jboss-jsf-api_2.2_spec-2.2.5.jar:2.2.5]

              at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2187) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:296) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:294) [wildfly-jsf-injection-8.0.0.Final.jar:8.0.0.Final]

              at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:691) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:253) [jsf-impl-2.2.5-jbossorg-3.jar:]

              at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]

              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:187) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86)

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71)

              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:1145) [rt.jar:1.7.0_45]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

              at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

       

      14:04:05,855 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./rest: org.jboss.msc.service.StartException in service jboss.underto

      w.deployment.default-server.default-host./rest: Failed to start service

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

              at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.builder.FlowDefinition

              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:216)

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86)

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

              ... 3 more

      Caused by: java.lang.RuntimeException: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.builder.FlowDefinition

              at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)

              at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)

              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:187)

              ... 7 more

      Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.builder.FlowDefinition

              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:680)

              at org.jboss.weld.util.ForwardingBeanManager.getContext(ForwardingBeanManager.java:181)

              at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.loadFlows(ApplicationAssociate.java:323)

              at com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:303)

              at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)

              at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2187)

              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:691)

              at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:253)

              ... 9 more

       

       

      I also got following errors on shutdown:

       

      14:41:54,235 SEVERE [javax.faces] (MSC service thread 1-3) Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?

      14:41:54,238 SEVERE [javax.faces] (MSC service thread 1-3) Unable to call @PreDestroy annotated methods because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI?

       

      I got those 2 lines twice each if I redeployed.

       

      I figured out the problem as it was only the missing beans.xml file. But I thought I'd bring this up as it is highly misleading information from those exceptions. I kept wondering why there was a JSF error in a JSF-free project.

       

      I believe a missing beans.xml file is a typical newbie error, can there not be an exception at start up saying something like : "you're trying to use CDI, but you have no beans.xml"?

       

      Dirk