Hello,
I currently evaluate SEAM. I startet with the reading the docs and trying he
booking and dvdstore examples.
After that I startet with my own small demo app.
I developed a simple Entity-Bean and two SFSBs. The first with a pageflow to insert an
Entity, the second load the values in a form to update/modify the Entity.
The SFBS with the pageflow to create a new Entity works fine.
But the second to load a created Entity to a Webform and update it does not!
When I select the Entity from the list the begin() Method of the second pageflow is called
but never reaches the selectSkill Method...
The server.log shows that the editSkill component first created and then immidiatly
removed??
-->Stateful component was removed: editSkill
I think it is a stupid beginners error but I can't figure it out...
I hope somebody can give me a hint!
Here is the stacktrace from the server.log
| 2006-09-22 11:10:16,177 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking
for a JTA transaction to join
| 2006-09-22 11:10:16,177 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered
Synchronization
| 2006-09-22 11:10:16,177 DEBUG
[org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor] ++++
LongLivedSessionPropagationInterceptor
| 2006-09-22 11:10:16,177 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking
for a JTA transaction to join
| 2006-09-22 11:10:16,177 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl]
Transaction already joined
| 2006-09-22 11:10:16,177 DEBUG [org.jboss.seam.contexts.Contexts] found in session
context: skillList
| 2006-09-22 11:10:16,177 DEBUG [org.jboss.mx.loading.RepositoryClassLoader]
setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@18b492,
cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@4301c9{ url=null
,addedOrder=0}
| 2006-09-22 11:10:16,177 INFO [STDOUT] -------------------------------
| 2006-09-22 11:10:16,177 INFO [STDOUT] ---> start pageflow EditSkill
| 2006-09-22 11:10:16,177 INFO [STDOUT] -------------------------------
| 2006-09-22 11:10:16,177 DEBUG [org.jboss.mx.loading.RepositoryClassLoader]
setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@18b492,
cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@12a375b{ url=null
,addedOrder=0}
| 2006-09-22 11:10:16,177 DEBUG [org.jboss.seam.interceptors.RemoveInterceptor] Stateful
component was removed: editSkill
| 2006-09-22 11:10:16,192 ERROR [STDERR] java.lang.RuntimeException:
org.hibernate.TransactionException: Could not register synchronization
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:273)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.ejb3.AbstractPool.remove(AbstractPool.java:171)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.ejb3.cache.simple.SimpleStatefulCache.remove(SimpleStatefulCache.java:299)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:89)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 2006-09-22 11:10:16,192 ERROR [STDERR] at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| 2006-09-22 11:10:16,208 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:188)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at $Proxy104.begin(Unknown Source)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:585)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.Component.callComponentMethod(Component.java:1334)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.Component.callCreateMethod(Component.java:1322)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.Component.newInstance(Component.java:1312)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.Component.getInstance(Component.java:1263)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.Component.getInstance(Component.java:1246)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:569)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:450)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.core.Pages.callAction(Pages.java:212)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:127)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:98)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:50)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.beforePhase(SeamExtendedManagedPersistencePhaseListener.java:38)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersBefore(LifecycleImpl.java:520)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:342)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
| 2006-09-22 11:10:16,223 ERROR [STDERR] Caused by: org.hibernate.TransactionException:
Could not register synchronization
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:159)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:59)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulBeanContext.closeExtendedPCs(StatefulBeanContext.java:284)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:268)
| 2006-09-22 11:10:16,223 ERROR [STDERR] ... 65 more
| 2006-09-22 11:10:16,223 ERROR [STDERR] Caused by: javax.transaction.RollbackException:
Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=korkng/35,
BranchQual=, localId=35]
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:635)
| 2006-09-22 11:10:16,223 ERROR [STDERR] at
org.hibernate.transaction.CMTTransaction.registerSynchronization(CMTTransaction.java:156)
| 2006-09-22 11:10:16,223 ERROR [STDERR] ... 68 more
| 2006-09-22 11:10:16,223 ERROR [org.jboss.seam.servlet.SeamExceptionFilter] uncaught
exception handled by Seam
| javax.servlet.ServletException: Exception while invoking expression
#{editSkill.selectSkill}
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
The section from the dataTable with the "Bearbeiten" (edit) link:
| <h:dataTable id="skills" value="#{skills}" var="s"
rendered="#{skills.rowCount>0}">
| <h:column>
| <f:facet name="header">Name</f:facet>
| #{s.name}
| </h:column>
| <h:column>
| <f:facet name="header">Beschreibung</f:facet>
| #{s.beschreibung}
| </h:column>
| <h:column>
| <f:facet name="header">Bearbeiten</f:facet>
| <s:link id="selectSkill" value="Bearbeiten"
action="#{editSkill.selectSkill}"/>
| </h:column>
|
| </h:dataTable>
|
The pageflow:
| <?xml version="1.0"?>
|
| <pageflow-definition name="EditSkill">
| <start-page name="start" view-id="/skill_list.xhtml">
| <redirect/>
| <transition name="EnterSkill" to="EnterSkillPage"/>
|
| </start-page>
|
| <page name="EnterSkillPage"
view-id="/editskill_form.xhtml">
| <redirect/>
| <transition name="CheckSkill" to="SaveSkill" >
| <action expression="#{editSkill.updateSkill}" />
| </transition>
| </page>
|
|
| <page name="SaveSkill" view-id="/skill_list.xhtml">
| <redirect/>
| <end-conversation/>
| </page>
| </pageflow-definition>
|
Here is the SFSB:
| package activegroup.seam.business;
|
| import java.io.Serializable;
|
| import javax.annotation.Resource;
| import javax.ejb.Remove;
| import javax.ejb.SessionContext;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.PersistenceContextType;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Begin;
| import org.jboss.seam.annotations.Conversational;
| import org.jboss.seam.annotations.Create;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.log.Log;
|
| import activegroup.seam.model.Skill;
|
| @Stateful
| @Name("editSkill")
| @Scope(ScopeType.CONVERSATION)
| @Conversational(ifNotBegunOutcome="skill_list")
| public class EditSkillAction implements EditSkill,Serializable{
|
| private static final long serialVersionUID = 1L;
|
| @Logger
| private Log log;
|
| @PersistenceContext(type=PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @Resource
| private SessionContext ctx;
|
| @In(required=false)
| @Out
| private Skill skill;
|
| @In
| private SkillList skillList;
|
| @Create
| @Begin(pageflow="EditSkill")
| public void begin()
| {
| System.out.println("-------------------------------");
| System.out.println("---> start pageflow EditSkill");
| System.out.println("-------------------------------");
| }
|
| public String selectSkill()
| {
| System.out.println("-------------------------------");
| System.out.println("---> selectSkill called");
| System.out.println("-------------------------------");
| this.skill=em.merge(this.skillList.getSelectedSkill());
| System.out.println("-------------------------------");
| System.out.println("---> selected skill="+this.skill.getName()+"
merged... return EnterSkill");
| System.out.println("-------------------------------");
| return "EnterSkill";
| }
|
| public void updateSkill()
| {
| log.debug("updateSkill");
| try {
| em.merge(this.skill);
| } catch (RuntimeException e) {
| e.printStackTrace();
| log.error(e.getMessage());
| ctx.setRollbackOnly();
| }
|
| }
| @Destroy @Remove
| public void destroy() {}
|
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973511#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...