![](/img/trans.png)
[英]WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
[英]WELD-001303 with JSF Flows Packaged in EAR File - WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
使用JSF Flows将WAR文件转换为EAR文件。 WAR文件结构为:
booking/booking-flow.xml
booking/booking.xhtml
booking/confirm.xhtml
booking/print.xhtml
booking/showtimes.xhtml
WEB-INF/classes/org/javaee7/movieplex7/booking/Booking.class
WEB-INF/faces-config.xml
WEB-INF/template.xhtml
WEB-INF/web.xml
faces-config.xml
是:
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
</faces-config>
web.xml
是:
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CLIENT_WINDOW_MODE</param-name>
<param-value>url</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
booking-flow.xml
是:
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<flow-definition id="booking">
<flow-return id="goHome">
<from-outcome>/index</from-outcome>
</flow-return>
</flow-definition>
</faces-config>
当打包为WAR文件时,JSF Flow可以正常工作。 但是它给出了以下错误:
org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
当将此文件打包为EAR文件中的WAR文件时。 EAR结构为:
booking-1.0-SNAPSHOT.war
./lib
./lib/contracts-1.0-SNAPSHOT.jar
booking-1.0-SNAPSHOT.war
结构是:
booking/booking-flow.xml
booking/booking.xhtml
booking/confirm.xhtml
booking/print.xhtml
booking/showtimes.xhtml
WEB-INF/beans.xml
WEB-INF/classes/org/javaee7/movieplex7/booking/Booking.class
WEB-INF/classes/org/javaee7/movieplex7/booking/MainPage.class
WEB-INF/faces-config.xml
WEB-INF/web.xml
需要MainPage
类才能从REST端点检索结果。 资源库协定存储在lib目录中。
在GlassFish 4.1上部署应用程序。
知道为什么它在独立的WAR文件中有效但在EAR文件中打包时无效吗?
您要在哪里部署? 当升级AS7.1.1以使用JSF2.2时, https://developer.jboss.org/thread/203257会有所帮助。 他们指出,FlowScoped不适用于AS7.1.1(以及其他潜在功能)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.