Jsf Wildfly 8部署错误(或)org.jboss.weld.context.ContextNotActivieException

Jsf Wildfly 8部署错误(或)org.jboss.weld.context.ContextNotActivieException,jsf,deployment,ejb,ear,wildfly-8,Jsf,Deployment,Ejb,Ear,Wildfly 8,当我尝试将webproject(使用jsf)和ejb项目结合到使用eclipse on wildfly 8.0.0 Final的单个EAR项目中时,出现了以下错误。我不知道这些错误出现的原因。事实上,每个单独的项目(JSFWeb项目和ejb项目)在组合成单个ear之前都工作得很好 21:38:31,951 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI d

当我尝试将webproject(使用jsf)和ejb项目结合到使用eclipse on wildfly 8.0.0 Final的单个EAR项目中时,出现了以下错误。我不知道这些错误出现的原因。事实上,每个单独的项目(JSFWeb项目和ejb项目)在组合成单个ear之前都工作得很好

21:38:31,951 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: test.ear
21:38:31,953 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment test.ear
21:38:31,967 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-6) Initializing Mojarra 2.2.5-jbossorg-3 20140128-1641 for context '/JSFTest'
21:38:32,081 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-6) 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)
我的JSF项目只有一个index.xhtml,如下所示

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core">
   <h:head>
      <title>JSF tutorial</title>           
   </h:head>
   <h:body> 
   <h2>hello Example</h2>
   <h:form>
      <h:outputLabel>Hello</h:outputLabel>
   </h:form>   
</h:body>
</html>

我在谷歌上搜索了这些错误代码(WELD-001303),发现这仍然是wildfly 8.0.0 final的问题。我们可以通过在web-inf下创建beans.xml来解决这个问题。
注意:无论我们是否使用CDI,默认情况下都会启用CDI。

似乎是用8.1.0.CR2修复的:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>JSF</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

    <!-- Change to "Production" when you are ready to deploy -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <!-- JSF mapping -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Map these files with JSF -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name> 
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
</web-app>
package test;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 * Session Bean implementation class Hello
 */
@Stateless
@LocalBean
public class Hello implements HelloRemote, HelloLocal {

    /**
     * Default constructor. 
     */
    public Hello() {
        // TODO Auto-generated constructor stub
    }

    @Override
    public String sayHello() {

        return "hello";
    }

}