Note that there are some explanatory texts on larger screens.

plurals
  1. POJBoss Seam: In ScopeType.PAGE I get: java.lang.IllegalStateException: No conversation context active
    primarykey
    data
    text
    <p>I have a page-scoped component, which has an instance variable List with data, which I display in a datatable. This datatable has pagination, sorting and filtering.</p> <p>The first time gate into the page, I get this appended in my URL: <strong>?conversationId=97</strong>. The page works correctly, and when I change datatable pages no now component is created.</p> <p>After a minute or two, and at seamingly random time, I get an exception saying that there is no context. I have not used @Create in my code or my navigation files.</p> <p>So, I have two questions:</p> <ul> <li>Why do I get this suffix in my URL? Why did a conversation start?</li> <li>Why the exception? The component is scoped to PAGE. If I received an exception, it should not be related to a conversation. Right? Or is the conversation the exception is referring a temporary conversation?</li> </ul> <p>Cheers!</p> <p><strong>UPDATE I:</strong></p> <p>The project is an Ear.</p> <p>This is the page:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"&gt; &lt;body&gt; &lt;ui:composition template="/WEB-INF/facelets/templates/template.xhtml"&gt; &lt;ui:define name="content"&gt; &lt;!-- This method returns focus on the filter --&gt; &lt;script type="text/javascript"&gt; function submitByEnter(event){ if (event.keyCode == 13) { if (event.preventDefault) { // Firefox event.preventDefault(); } else { // IE event.returnValue = false; } document.getElementById("refreshButton").click(); } } &lt;/script&gt; &lt;h:form prependId="false"&gt; &lt;h:commandButton action="Back" value="Back to home page" /&gt; &lt;br /&gt; &lt;p&gt;&lt;h:outputText value="Applicants and Products (experimentation page)" class="page_title" /&gt;&lt;/p&gt; &lt;h:commandButton action="#{applicantProductListBean.showCreateApplicant}" value="Create Applicant" id="createApplicantButton"&gt; &lt;/h:commandButton&gt; &lt;a4j:commandButton value="Refresh" id="refreshButton" action="#{applicantProductListBean.refreshData}" image="/images/icons/refresh48x48.gif" reRender="compositeTable, compositeScroller"&gt; &lt;!-- &lt;f:setPropertyActionListener--&gt; &lt;!-- target="# {pageScrollerBean.applicantProductListPage}" value="1" /&gt;--&gt; &lt;/a4j:commandButton&gt; &lt;rich:toolTip for="createApplicantButton" value="Create Applicant" /&gt; &lt;rich:dataTable styleClass="composite2DataTable" id="compositeTable" rows="1" columnClasses="col" value="#{applicantProductListBean.dataModel}" var="pageAppList"&gt; &lt;f:facet name="header"&gt; &lt;rich:columnGroup&gt; &lt;rich:column colspan="3"&gt; &lt;h:outputText styleClass="headerText" value="Applicants" /&gt; &lt;/rich:column&gt; &lt;rich:column colspan="3"&gt; &lt;h:outputText styleClass="headerText" value="Products" /&gt; &lt;/rich:column&gt; &lt;rich:column breakBefore="true"&gt; &lt;h:outputText styleClass="headerText" value="Applicant Name" /&gt; &lt;a4j:commandButton id="sortingApplicantNameButton" action="#{applicantProductListBean.toggleSorting('applicantName')}" image="/images/icons/sorting/#{sortingFilteringBean.applicantProductListSorting.sortingValues['applicantName']}.gif" reRender="sortingApplicantNameButton, sortingApplicantEmailButton, compositeTable, compositeScroller"&gt; &lt;!-- &lt;f:setPropertyActionListener--&gt; &lt;!-- target="#{pageScrollerBean.applicantProductListPage}" value="1" /&gt;--&gt; &lt;/a4j:commandButton&gt; &lt;br /&gt; &lt;h:inputText value="#{sortingFilteringBean.applicantProductListFiltering.filteringValues['applicantName']}" id="applicantNameFilterValue" onkeypress="return submitByEnter(event)"&gt; &lt;/h:inputText&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;h:outputText styleClass="headerText" value="Applicant Email" /&gt; &lt;a4j:commandButton id="sortingApplicantEmailButton" action="#{applicantProductListBean.toggleSorting('applicantEmail')}" image="/images/icons/sorting/#{sortingFilteringBean.applicantProductListSorting.sortingValues['applicantEmail']}.gif" reRender="sortingApplicantNameButton, sortingApplicantEmailButton, compositeTable, compositeScroller"&gt; &lt;!-- &lt;f:setPropertyActionListener--&gt; &lt;!-- target="#{pageScrollerBean.applicantProductListPage}" value="1" /&gt;--&gt; &lt;/a4j:commandButton&gt; &lt;br /&gt; &lt;h:inputText value="#{sortingFilteringBean.applicantProductListFiltering.filteringValues['applicantEmail']}" id="applicantEmailFilterValue" onkeypress="return submitByEnter(event)"&gt; &lt;/h:inputText&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;h:outputText styleClass="headerText" value="Applicant Actions" /&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;h:outputText styleClass="headerText" value="Product Name" /&gt; &lt;a4j:commandButton id="sortingProductNameButton" action="#{applicantProductListBean.toggleSorting('productName')}" immediate="true" image="/images/icons/sorting/#{sortingFilteringBean.applicantProductListSorting.sortingValues['productName']}.gif" reRender="sortingProductNameButton, compositeTable, compositeScroller"&gt; &lt;/a4j:commandButton&gt; &lt;br /&gt; &lt;h:inputText value="#{sortingFilteringBean.applicantProductListFiltering.filteringValues['productName']}" id="productNameFilterValue" onkeypress="return submitByEnter(event)"&gt; &lt;/h:inputText&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;h:outputText styleClass="headerText" value="Product Email" /&gt; &lt;br /&gt; &lt;h:inputText value="#{sortingFilteringBean.applicantProductListFiltering.filteringValues['productEmail']}" id="productEmailFilterValue" onkeypress="return submitByEnter(event)"&gt; &lt;/h:inputText&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;h:outputText styleClass="headerText" value="Product Actions" /&gt; &lt;/rich:column&gt; &lt;/rich:columnGroup&gt; &lt;/f:facet&gt; &lt;rich:subTable rowClasses="odd_applicant_row, even_applicant_row" value="#{pageAppList}" var="app"&gt; &lt;rich:column styleClass=" internal_cell composite2TextContainingColumn" valign="top"&gt; &lt;h:outputText value="#{app.name}" /&gt; &lt;/rich:column&gt; &lt;rich:column styleClass="internal_cell composite2TextContainingColumn" valign="top"&gt; &lt;h:outputText value="#{app.receiptEmail}" /&gt; &lt;/rich:column&gt; &lt;rich:column valign="top" styleClass="buttonsColumn"&gt; &lt;h:commandButton action="#{applicantProductListBean.showUpdateApplicant(app)}" image="/images/icons/edit.jpg"&gt; &lt;/h:commandButton&gt; &lt;!-- &lt;rich:toolTip for="editApplicantButton" value="Edit Applicant" /&gt;--&gt; &lt;h:commandButton action="#{applicantProductListBean.showDeleteApplicant(app)}" image="/images/icons/delete.png"&gt; &lt;/h:commandButton&gt; &lt;!-- &lt;rich:toolTip for="deleteApplicantButton" value="Delete Applicant" /&gt;--&gt; &lt;/rich:column&gt; &lt;rich:column colspan="3"&gt; &lt;table class="productsTableTable"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="createProductButtonTableCell"&gt;&lt;h:commandButton action="#{applicantProductListBean.showCreateProduct(app)}" value="Create Product"&gt; &lt;/h:commandButton&gt; &lt;!-- &lt;rich:toolTip for="createProductButton" value="Create Product" /&gt;--&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;rich:dataTable value="#{app.products}" var="prod" rowClasses="odd_product_row, even_product_row"&gt; &lt;rich:column styleClass="internal_cell composite2TextContainingColumn"&gt; &lt;h:outputText value="#{prod.inventedName}" /&gt; &lt;/rich:column&gt; &lt;rich:column styleClass="internal_cell composite2TextContainingColumn"&gt; &lt;h:outputText value="#{prod.receiptEmail}" /&gt; &lt;/rich:column&gt; &lt;rich:column styleClass="buttonsColumn"&gt; &lt;h:commandButton action="#{applicantProductListBean.showUpdateProduct(prod)}" image="/images/icons/edit.jpg"&gt; &lt;/h:commandButton&gt; &lt;!-- &lt;rich:toolTip for="editProductButton" value="Edit Product" /&gt;--&gt; &lt;h:commandButton action="#{applicantProductListBean.showDeleteProduct(prod)}" image="/images/icons/delete.png"&gt; &lt;f:setPropertyActionListener target="#{productBean.product}" value="#{prod}" /&gt; &lt;/h:commandButton&gt; &lt;!-- &lt;rich:toolTip for="deleteProductButton" value="Delete Product" /&gt;--&gt; &lt;/rich:column&gt; &lt;/rich:dataTable&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/rich:column&gt; &lt;/rich:subTable&gt; &lt;f:facet name="footer"&gt; &lt;h:panelGrid columns="1" styleClass="applicantProductListFooter"&gt; &lt;h:outputText value="#{msgs.no_results}" rendered="#{(empty applicantProductListBean.dataModel) || (applicantProductListBean.dataModel.rowCount==0)}"/&gt; &lt;rich:datascroller align="center" for="compositeTable" page="#{pageScrollerBean.applicantProductListPage}" id="compositeScroller" reRender="compositeTable" renderIfSinglePage="false" fastControls="hide"&gt; &lt;f:facet name="first"&gt; &lt;h:outputText value="#{msgs.first}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="first_disabled"&gt; &lt;h:outputText value="#{msgs.first}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="last"&gt; &lt;h:outputText value="#{msgs.last}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="last_disabled"&gt; &lt;h:outputText value="#{msgs.last}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="next"&gt; &lt;h:outputText value="#{msgs.next}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="next_disabled"&gt; &lt;h:outputText value="#{msgs.next}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="previous"&gt; &lt;h:outputText value="#{msgs.previous}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;f:facet name="previous_disabled"&gt; &lt;h:outputText value="#{msgs.previous}" styleClass="scrollerCell" /&gt; &lt;/f:facet&gt; &lt;/rich:datascroller&gt; &lt;/h:panelGrid&gt; &lt;/f:facet&gt; &lt;/rich:dataTable&gt; &lt;/h:form&gt; &lt;/ui:define&gt; </code></pre> <p></p> <p> </p> <p>This is the backing bean:</p> <pre><code>@Name("applicantProductListBean") @Scope(ScopeType.PAGE) public class ApplicantProductListBean extends BasePagedSortableFilterableListBean { /** * Public field for ad-hoc injection to work. */ @EJB(name = "FacadeService") public ApplicantFacadeService applicantFacadeService; @Logger private static Log logger; private final int pageSize = 10; @Out(scope = ScopeType.CONVERSATION, required = false) Applicant currentApplicant; @Out(scope = ScopeType.CONVERSATION, required = false) Product product; @Create public void onCreate() { System.out.println("Create"); } @Override protected DataModel initDataModel(int pageSize) { // get filtering and sorting from session sorting = getSorting(); filtering = getFiltering(); // System.out.println("Initializing a Composite3DataModel"); // System.out.println("Pagesize: " + pageSize); // System.out.println("Filtering: " + filtering.getFilteringValues()); // System.out.println("Sorting: " + sorting.getSortingValues()); return new Composite3DataModel(1, sorting, filtering); } // Navigation methods /** * Navigation-returning method, returns the action to follow after pressing * the "Create Applicant" button * * @return the action to be taken */ public Navigation.ApplicantProductList showCreateApplicant() { return Navigation.ApplicantProductList.SHOW_CREATE_APPLICANT; } /** * Navigation-returning method, returns the action to follow after pressing * the "Edit Applicant" button * * @return the action to be taken */ public Navigation.ApplicantProductList showUpdateApplicant( Applicant applicant) { this.currentApplicant = applicant; return Navigation.ApplicantProductList.SHOW_UPDATE_APPLICANT; } /** * Navigation-returning method, returns the action to follow after pressing * the "Delete Applicant" button * * @return the action to be taken */ public Navigation.ApplicantProductList showDeleteApplicant( Applicant applicant) { this.currentApplicant = applicant; return Navigation.ApplicantProductList.SHOW_DELETE_APPLICANT; } /** * Navigation-returning method, returns the action to follow after pressing * the "Create Product" button * * @return the action to be taken */ public Navigation.ApplicantProductList showCreateProduct(Applicant app) { this.product = new Product(); this.product.setApplicant(app); return Navigation.ApplicantProductList.SHOW_CREATE_PRODUCT; } /** * Navigation-returning method, returns the action to follow after pressing * the "Edit Product" button * * @return the action to be taken */ public Navigation.ApplicantProductList showUpdateProduct(Product prod) { this.product = prod; return Navigation.ApplicantProductList.SHOW_UPDATE_PRODUCT; } /** * Navigation-returning method, returns the action to follow after pressing * the "Delete Product" button * * @return the action to be taken */ public Navigation.ApplicantProductList showDeleteProduct(Product prod) { this.product = prod; return Navigation.ApplicantProductList.SHOW_DELETE_PRODUCT; } /** * */ @Override public Sorting getSorting() { if (sorting == null) { return (getSortingFilteringBeanFromSession() .getApplicantProductListSorting()); } return sorting; } /** * */ @Override public void setSorting(Sorting sorting) { getSortingFilteringBeanFromSession().setApplicantProductListSorting( sorting); } /** * */ @Override public Filtering getFiltering() { if (filtering == null) { return (getSortingFilteringBeanFromSession() .getApplicantProductListFiltering()); } return filtering; } /** * */ @Override public void setFiltering(Filtering filtering) { getSortingFilteringBeanFromSession().setApplicantProductListFiltering( filtering); } /** * @return the currentApplicant */ public Applicant getCurrentApplicant() { return currentApplicant; } /** * @param currentApplicant * the currentApplicant to set */ public void setCurrentApplicant(Applicant applicant) { this.currentApplicant = applicant; } /** * The model for this page * */ private class Composite3DataModel extends PagedSortableFilterableDataModel&lt;List&lt;Applicant&gt;&gt; { public Composite3DataModel(int pageSize, Sorting sorting, Filtering filtering) { super(pageSize, sorting, filtering); } @Override protected DataPage&lt;List&lt;Applicant&gt;&gt; fetchPage(int fakeStartRow, int fakePageSize) { // if (logger.isTraceEnabled()) { System.out.println("Getting page with fakeStartRow: " + fakeStartRow + " and fakePageSize " + fakePageSize); // } // to find the page size multiply the startRow and the fakePageSize // (which is 1) to the actual page size int startRow = fakeStartRow * ApplicantProductListBean.this.pageSize; int pageSize = fakePageSize * ApplicantProductListBean.this.pageSize; // if (logger.isTraceEnabled()) { System.out.println("Getting page with startRow: " + startRow + " and pageSize " + pageSize); // } List&lt;Applicant&gt; pageApplicants = applicantFacadeService .findPagedWithCriteria(startRow, pageSize, filtering, sorting); // List&lt;Applicant&gt; pageApplicants = applicantFacadeService // .findPagedWithDynamicQuery(startRow, pageSize, filtering, // sorting, true); // if (logger.isTraceEnabled()) { System.out.println("Set of applicants: " + pageApplicants.size()); // } List&lt;List&lt;Applicant&gt;&gt; pageApplicantsListContainer = new ArrayList&lt;List&lt;Applicant&gt;&gt;(); pageApplicantsListContainer.add(pageApplicants); DataPage&lt;List&lt;Applicant&gt;&gt; dataPage = new DataPage&lt;List&lt;Applicant&gt;&gt;( this.getRowCount(), fakeStartRow, pageApplicantsListContainer); return dataPage; } @Override protected int getDatasetSize() { // int size = getServiceFacade().countWithCriteria(filtering, // sorting); // int size = // applicantFacadeService.countWithDynamicQuery(filtering, sorting, // false); int size = (int) Math.ceil((double) applicantFacadeService .countWithCriteria(filtering, sorting, false) / pageSize); if (logger.isTraceEnabled()) { logger.trace("Got Dataset Size: " + size); } return size; } } /** * @return the product */ public Product getProduct() { return product; } /** * @param product * the product to set */ public void setProduct(Product product) { this.product = product; } } </code></pre> <p>And this is the page file (Notice that as long as I don't leave the page no conversation is created):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;page&gt; &lt;navigation&gt; &lt;rule if-outcome="Back"&gt; &lt;redirect view-id="/index.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_CREATE_PRODUCT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/product/createProduct.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_UPDATE_PRODUCT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/product/editProduct.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_DELETE_PRODUCT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/product/deleteProduct.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_CREATE_APPLICANT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/applicant/createApplicant.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_UPDATE_APPLICANT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/applicant/editApplicant.xhtml" /&gt; &lt;/rule&gt; &lt;rule if-outcome="SHOW_DELETE_APPLICANT"&gt; &lt;begin-conversation join="true" /&gt; &lt;redirect view-id="/pages/applicant/deleteApplicant.xhtml" /&gt; &lt;/rule&gt; &lt;/navigation&gt; &lt;/page&gt; </code></pre> <p><strong>UPDATE II:</strong></p> <p>the stacktrace is <a href="http://pastebin.com/9egKQV1C" rel="nofollow noreferrer">here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload