简体   繁体   中英

Seam pageflow example NumberGuess Not landing on to the second page

I'm trying to run simple Seam PageFlow example NumberGuss. I have deployed it on Jboss Server. When I access the URL it lands on the first page but if I hit any of the button provided on that page it says "The page isn't redirecting properly".On server log I found

SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-16) Error Rendering View[/debug.xhtml]: org.jboss.weld.context.NonexistentConversationException: WELD-000321: No conversation found to restore for id 1.

I'm using wildfly-8.1.0 and jboss-seam-2.3.1

Attaching pageflow.jpdl.xml and numberGuess.xhtml for reference. Please help me resolve the issue I'm facing.

 <!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" xmlns:s="http://jboss.org/schema/seam/taglib"> <h:head> <title>Guess a number...</title> <link href="niceforms.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="niceforms.js"><!-- --></script> </h:head> <body> <h1>Guess a number...</h1> <h:form id="NumberGuessMain" styleClass="niceform"> <div> <h:messages id="messages" globalOnly="true"/> <h:outputText id="Higher" value="Higher!" rendered="#{numberGuess.randomNumber gt numberGuess.currentGuess}"/> <h:outputText id="Lower" value="Lower!" rendered="#{numberGuess.randomNumber lt numberGuess.currentGuess}"/> </div> <div> I'm thinking of a number between <h:outputText id="Smallest" value="#{numberGuess.smallest}"/> and <h:outputText id="Biggest" value="#{numberGuess.biggest}"/>. You have <h:outputText id="RemainingGuesses" value="#{numberGuess.remainingGuesses}"/> guesses. </div> <div> Your guess: <h:inputText id="inputGuess" value="#{numberGuess.currentGuess}" required="true" size="3" rendered="#{(numberGuess.biggest-numberGuess.smallest) gt 20}"> <f:validateLongRange maximum="#{numberGuess.biggest}" minimum="#{numberGuess.smallest}"/> </h:inputText> <h:selectOneMenu id="selectGuessMenu" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.selectMenuRendered}"> <s:selectItems id="PossibilitiesMenuItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/> </h:selectOneMenu> <h:selectOneRadio id="selectGuessRadio" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.radioButtonRendered}"> <s:selectItems id="PossibilitiesRadioItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/> </h:selectOneRadio> <h:commandButton id="GuessButton" value="Guess" action="guess"/> <s:button id="CheatButton" value="Cheat" action="cheat"/> <s:button id="GiveUpButton" value="Give up" action="giveup"/> </div> <div> <h:message id="message" for="inputGuess" style="color: red"/> </div> </h:form> </body> </html> 
 <!-- An example of pageflow in jPDL. This exemplifies the approach where action handlers are attached transitions and decision nodes, instead of view components. An alternative approach would be to attach all action handlers to view components, and let the jPDL define only the navigation rules. --> <pageflow-definition xmlns="http://jboss.org/schema/seam/pageflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.org/schema/seam/pageflow http://jboss.org/schema/seam/pageflow-2.3.xsd" name="numberGuess"> <start-page name="displayGuess" view-id="/numberGuess.xhtml"> <redirect/> <transition name="guess" to="evaluateGuess"> <action expression="#{numberGuess.guess}"/> </transition> <transition name="giveup" to="giveup"/> <transition name="cheat" to="cheat"/> </start-page> <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}"> <transition name="true" to="win"/> <transition name="false" to="evaluateRemainingGuesses"/> </decision> <decision name="evaluateRemainingGuesses" expression="#{numberGuess.lastGuess}"> <transition name="true" to="lose"/> <transition name="false" to="displayGuess"/> </decision> <page name="giveup" view-id="/giveup.xhtml"> <redirect/> <transition name="yes" to="lose"/> <transition name="no" to="displayGuess"/> </page> <process-state name="cheat"> <sub-process name="cheat"/> <transition to="displayGuess"/> </process-state> <page name="win" view-id="/win.xhtml"> <redirect/> <end-conversation/> </page> <page name="lose" view-id="/lose.xhtml"> <redirect/> <end-conversation/> </page> </pageflow-definition> 

Resolved the issue.Weld is scanning the archive, which seems to cause the problem.The Weld Docs says: You can either set this up for your deployment only by adding the following content to the META-INF/jboss-all.xml file of your application. jboss-all.xml file goes to your META-INF for ear archive and likely to WEB-INF for war archive

<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss> 

It worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM