Converting a WAR file using JSF Flows into an EAR file. WAR file structure is:
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
is:
<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
is:
<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
is:
<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>
JSF Flow works fine when packaged as a WAR file. But it gives the following error:
org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
when this is packaged as a WAR file within an EAR file. EAR structure is:
booking-1.0-SNAPSHOT.war
./lib
./lib/contracts-1.0-SNAPSHOT.jar
booking-1.0-SNAPSHOT.war
structure is:
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
class is required to retrieve the results from REST endpoint. Resource library contracts are stored in the lib directory.
Deploying the application on GlassFish 4.1.
Any idea why this works in standalone WAR file but not when packaged in EAR file?