Weld 2.0 under Tomcat 7
sjhgo82.da Jul 1, 2013 5:06 AMHello,
I am testing Faces Flow Scopes of JSF 2.2. Therefore I can run the example application checkout-module from the javaee 7 turorial Sect. 16.3
http://docs.oracle.com/javaee/7/tutorial/doc/jsf-configure003.htm#sthref1026
under Glassfish 4.0 final without any problems.
Now I tried to run the example under Apache Tomcat with Weld. The whole Eclipse-Project is attached. I did all as told from the weld documentation in chapter 18.3
http://docs.jboss.org/weld/reference/2.0.1.Final/en-US/html/environments.html#d0e5324
WEB-INF/web.xml:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="FlowScopeTest" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
...
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>
javax.enterprise.inject.spi.BeanManager
</resource-env-ref-type>
</resource-env-ref>
</web-app>
{code}
META-INF/context.xml:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- disables storage of sessions across restarts -->
<!-- <Manager pathname=""/> -->
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
<!-- enable injection into Servlet -->
<!-- <Listener className="org.jboss.weld.environment.tomcat.WeldLifecycleListener"/> -->
<!--
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>META-INF/context.xml</WatchedResource>
-->
</Context>
{code}
Under WEB-INF/lib I have cdi-api.jar, weld-servlet.jar, and javax.faces-2.2.0.jar . Please note, I use Weld 2.0.0 Final as 2.0.1 Final does not operate in this setting: javax.el, logging, extra libraries needed, etc.
Now to the major problem.
src/javaeetutorial.checkoutmodule/CheckoutFlow.java
{code}
public class CheckoutFlow implements Serializable {
private static final long serialVersionUID = 1L;
@Produces
@FlowDefinition
public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder) {
System.out.println("----HelloHello----: currently not executed -> bug?");
String flowId = "checkoutFlow";
flowBuilder.id("", flowId);
flowBuilder.viewNode(flowId, "/" + flowId + "/" + flowId + ".xhtml")
.markAsStartNode();
flowBuilder.returnNode("returnFromCheckoutFlow")
.fromOutcome("#{checkoutFlowBean.returnValue}");
flowBuilder.inboundParameter("param1FromJoinFlow", "#{flowScope.param1Value}");
flowBuilder.inboundParameter("param2FromJoinFlow", "#{flowScope.param2Value}");
flowBuilder.flowCallNode("calljoin").flowReference("", "joinFlow")
.outboundParameter("param1FromCheckoutFlow", "#{checkoutFlowBean.name}")
.outboundParameter("param2FromCheckoutFlow", "#{checkoutFlowBean.city}");
return flowBuilder.getFlow();
}
}
{code}
The method defineFlow to programmatically define the flow scope is never executed, i.e., System.out.println(...) is never executed. GlassFish does this without problems while starting the webapp. Of course, the application later complains about the missing scope.
Is this a bug, do I make something wrong?
Please help. Many thanx.
Chris
-
FlowScopeTest.war 5.9 MB