[JBoss Seam] - missing conversation entry error
by gsegura
Hello
I'm having problems with a nested conversation, which after termination cannot restore the parent conversation only in 1 out of 3 similar (it seems so) cases.
Its a case of edition of item A which has a collection of items B, when edition of item A starts I begin a conversation,
inside that page every edition of items B is done inside a nested conversation.
It works fine except in case of deletion of item B, which throws IllegalStateException: missing conversation entry.
Here is the relevant code
this is the extract from master page (company which holds a collection of employees):
<!-- page for edition of Company -->
| <s:link value="Add employee" action="#{editorEmployee.create}" rendered="#{editorCompany.company.id!=null}"/>
|
| <rich:dataTable value="#{editorCompany.company.employees}" var="emp" rows="5" rendered="#{editorCompany.company.employees.size>0}">
| <h:column>
| <h:outputText value="#{emp.name}" />
| <br/>
| <s:link value="Edit" action="#{editorEmployee.select(emp)}" />
| </h:column>
| </rich:dataTable>
|
this is the extract from detail page (employee data):
| <h:form id="f">
|
| <s:div rendered="#{editorEmployee.employee.id!=null}">
| <h:commandLink id="btnEliminar" value="" action="#{editorEmployee.delete}"/>
| </s:div>
|
| <s:decorate id="nameDecorate" template="/layout/edit.xhtml">
| <ui:define name="label">Name:</ui:define>
| <h:inputText id="name" value="#{editorEmployee.employee.name}" required="true">
| <a4j:support event="onblur" reRender="nameDecorate"/>
| </h:inputText>
| </s:decorate>
|
| <div class="buttonBox">
| <h:commandLink action="#{editorEmployee.save}">
| <h:graphicImage value="/img/btn/btn_save.gif" alt="save" styleClass="btn" />
| </h:commandLink>
|
| <h:commandLink action="#{editorEmployee.cancel}" immediate="true">
| <h:graphicImage value="/img/btn/btn_cancel.gif" alt="cancel" styleClass="btn" />
| </h:commandLink>
| </div>
| </h:form>
|
the pages.xml:
| <page view-id="/admin/editorEmployee.xhtml">
| <navigation from-action="#{editorEmployee.save}">
| <rule if="#{editorEmployee.ok}">
| <redirect view-id="/admin/editorCompany.xhtml"/>
| </rule>
| <rule if="#{not editorEmployee.ok}">
| <redirect view-id="/admin/editorEmployee.xhtml"/>
| </rule>
| </navigation>
| <navigation from-action="#{editorEmployee.cancel}">
| <redirect view-id="/admin/editorCompany.xhtml"/>
| </navigation>
| <navigation from-action="#{editorEmployee.delete}">
| <redirect view-id="/admin/editorCompany.xhtml"/>
| </navigation>
| </page>
|
finally, the EditorEmployee.java
| @Scope(ScopeType.CONVERSATION)
| @Name("editorEmployee")
| @Restrict("#{identity.loggedIn and s:hasRole('Administrator')}")
| public class EditorEmployeeAction {
| @In("#{editorSede.sede}")
| Company company ;
|
| @Begin(nested=true, flushMode=FlushModeType.MANUAL)
| public void select(Employee selectedEmployee) {
| log.info("selectEmployee, beginning conversation.id=#0",Conversation.instance().getId()) ;
| employee = entityManager.merge(selectedEmployee);
| }
|
| @Begin(nested=true, flushMode=FlushModeType.MANUAL)
| public void crear() {
| log.info("newEmployee, beginning conversation.id=#0",Conversation.instance().getId()) ;
| employee = new Employee(company, "") ;
| }
|
| @End
| public void delete() {
| company.getEmployees().remove(employee) ;
| entityManager.remove(employee) ;
| entityManager.flush() ;
| log.info("deleted employee #0, conversation.id: #1",employee,Conversation.instance().getId()) ;
| facesMessages.add("Employee deleted successfully.") ;
| }
|
| public void save() {
| boolean valid = validateEmployee(employee) ;
| ok = false ;
| if(valid) {
| //agregate to collection only if new employee
| if(employee.getId()==null)
| company.getEmployees().add(employee) ;
|
| entityManager.persist(employee);
| facesMessages.add("Employee data saved ok");
| ok = true;
| entityManager.flush() ;
|
| log.info("finishing nested conversation #0",Conversation.instance().getId());
| //conversation ended programmatically because in case validation fails the page is redisplayed
| //and conversation must continue until canceled or data ok.
| Conversation.instance().end() ;
| }
| }
|
| @End
| public void cancel() {
| log.info("editing employee canceled.") ;
| }
|
Must part of this code works ok: creation or modification of employee, also if cancel action invoked.
But something goes wrong with invocation of editorEmployee.delete(), the object is deleted correctly
but the next view is not displayed, here is the complete stack trace:
| GRAVE: uncaught exception
| java.lang.IllegalStateException: missing conversation entry
| at org.jboss.seam.core.Conversation.flush(Conversation.java:124)
| at org.jboss.seam.core.Manager.flushConversationMetadata(Manager.java:882)
| at org.jboss.seam.faces.FacesManager.prepareBackswitch(FacesManager.java:278)
| at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:470)
| at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
| at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
| at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
| at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
| at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
| at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
| at java.lang.Thread.run(Unknown Source)
|
I can not see what is the difference with delete action, respect the others, could someone please give some advice on this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111494#4111494
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111494
18 years, 4 months
[Installation, Configuration & DEPLOYMENT] - jboss products integration?
by nitm
hi,
we're currently configuring a new server and we want to be able to use the following:
- j2ee (servlets, ejbs)
- hibernate
- php (for the view part)
the server is running with windows xp os (its just a development server).
we want to use the JBoss AS 4.2.2 and after a few days of reading, downloading, installing and configurating i came up with the following questions:
(1) do we need to have the JBoss Web as well? is it enough to use the JBoss Native 2.0.1 ? (in order to run php scripts)
(2) what will be the best way to use the jboss as a windows service: the java wrapper or the service.bat which comes with the jboss native?
(3) is it possible to use java objects from with in the php scripts? i know that the php/java bridge works good, but i never tested it in this kind of environment before.. is there another (better?) way to do so?
thanks a lot,
nitzan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111490#4111490
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111490
18 years, 4 months
[JBoss jBPM] - Re: Persitence problem
by rodosa
When the server starts also thrown an exception::
| 2007-12-10 00:19:50,312 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDATE4_26_, job0_.PROCESSINSTANCE_ as PROCESSI5_26_, job0_.TOKEN_ as TOKEN6_26_, job0_.TASKINSTANCE_ as TASKINST7_26_, job0_.ISSUSPENDED_ as ISSUSPEN8_26_, job0_.ISEXCLUSIVE_ as ISEXCLUS9_26_, job0_.LOCKOWNER_ as LOCKOWNER10_26_, job0_.LOCKTIME_ as LOCKTIME11_26_, job0_.EXCEPTION_ as EXCEPTION12_26_, job0_.RETRIES_ as RETRIES13_26_, job0_.NAME_ as NAME14_26_, job0_.REPEAT_ as REPEAT15_26_, job0_.TRANSITIONNAME_ as TRANSIT16_26_, job0_.ACTION_ as ACTION17_26_, job0_.GRAPHELEMENTTYPE_ as GRAPHEL18_26_, job0_.GRAPHELEMENT_ as GRAPHEL19_26_, job0_.NODE_ as NODE20_26_, job0_.CLASS_ as CLASS2_26_ from JBPM_JOB job0_ where (job0_.LOCKOWNER_ is null or job0_.LOCKOWNER_=?) and job0_.RETRIES_>0 and job0_.DUEDATE_<=? and job0_.ISSUSPENDED_<>1 order by job0_.DUEDATE_ asc]
| com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDAT' at line 1
| at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1027)
| at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
| at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
| at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
| at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
| at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
| at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
| at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
| at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
| at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
| at org.hibernate.loader.Loader.doQuery(Loader.java:662)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
| at org.hibernate.loader.Loader.doList(Loader.java:2145)
| at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
| at org.hibernate.loader.Loader.list(Loader.java:2024)
| at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
| at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
| at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:756)
| at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:40)
| at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:114)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111489#4111489
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111489
18 years, 4 months