-
1. Re: Manual flushing peristence context & NO transaction rollback
asookazian Oct 25, 2009 2:12 AM (in response to slaweksss)I'd assume that the transaction should not be committed in this case, but I've never tried that exact code (throwing RuntimeException) myself. The tx commits at the end of a successful method execution. Apparently, this save() method is successful...
-
2. Re: Manual flushing peristence context & NO transaction rollback
kapitanpetko Oct 25, 2009 5:13 AM (in response to slaweksss)If you are using POJO's the TransactionInterceptor should rollback the transaction in case of an exception. Set the log level for org.jboss.seam to DEBUG and check the logs. You could also try setting a breakpoint in TransactionInterceptor.
Other than that, are you sure changes are committed after the save() method throws? If, for example, edit() is not called you might be running in auto-commit mode.
-
3. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Oct 25, 2009 1:18 PM (in response to slaweksss)Thanks for suggestions gentlemen.
I did some source tracing and found that TransactionInterceptor delegates work to this class: org.jboss.seam.util.Wotk<T>
public final T workInTransaction() throws Exception
{
org.jboss.seam.transaction.UserTransaction transaction = Transaction.instance();
boolean transactionActive = transaction.isActiveOrMarkedRollback()
|| transaction.isRolledBack(); //TODO: temp workaround, what should we really do in this case??
boolean newTransactionRequired = isNewTransactionRequired(transactionActive);
UserTransaction userTransaction = newTransactionRequired ? transaction : null;
try
{
if (newTransactionRequired)
{
log.debug("beginning transaction");
userTransaction.begin();
}
T result = work();
if (newTransactionRequired)
{
if (transaction.isMarkedRollback())
{
log.debug("rolling back transaction");
userTransaction.rollback();
}
else
{
log.debug("committing transaction");
userTransaction.commit();
}
}
return result;
}
catch (Exception e)
{
if (newTransactionRequired && userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION && isRollbackRequired(e, true))
{
log.debug("rolling back transaction");
userTransaction.rollback();
}
throw e;
}
}
so...
in second line:
boolean transactionActive
this value is true
so then...
boolean newTransactionRequired
is false
so finally when exception occurs
catch (Exception e)
{
if (newTransactionRequired &&...
we have no rollback!
Am i screwed something?
It looks like there is some "external" transaction so this interceptor doesn't handle transaction.
A forgot to add: I'm using Seam 2.2.0GA and JBoss 5.0 (5.1 fall in infinite loop under JBoss tools while starting app) -
4. Re: Manual flushing peristence context & NO transaction rollback
kapitanpetko Oct 26, 2009 10:17 AM (in response to slaweksss)I wasn't able to reproduce. The transaction gets rolled back and nothing is committed in DB. What do you logs say?
Btw, there is also the RollbackInterceptor, that one sets rollbackOnly and the transaction is eventually
rolled back in SeamPhaseListener. Theexternal
transaction is also started by SeamPhaseListener (Seam global
transaction), that's why you newTransactionRequired is false.Can you show all the code of your action class?
-
5. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Oct 26, 2009 12:34 PM (in response to slaweksss)Thanks, I'll dig into the source deeper...
Here is DocumentEditor class:
package ...docflow.application;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import org.jboss.seam....
import pl.com.bottega.docflow.application.errors.InvalidParameterException;
import pl.com.bottega.docflow.application.errors.NoSuchDataException;
import pl.com.bottega.docflow.model.Document;
import pl.com.bottega.docflow.model.User;
@Name("documentEditor")
@Scope(ScopeType.CONVERSATION)
public class DocumentEditor implements Serializable{
@Out(value="editedDocument")
private Document document;
@In
private EntityManager entityManager;
@In
private Events events;
@Begin(flushMode=FlushModeType.MANUAL)
public String edit(Long docId){
document = entityManager.find(Document.class, docId);
return "/documentEditor.xhtml";
}
@Begin(flushMode=FlushModeType.MANUAL)
public String add(){
document = new Document();
return "/documentEditor.xhtml";
}
public String attributesPageDone(){
return "/documentEditorContent.xhtml";
}
@End
@Transactional(TransactionPropagationType.REQUIRED)
public String save(){
//entityManager.merge(document);
//if (DocumentStatus.RELEASED.equals(document.getStatus()))
// events.raiseTransactionSuccessEvent(EventsDictionary.DOCUMENT_RELEASED.toString(), document);
entityManager.flush();
if (document.getContent().contains("holly molly"))
throw new DocumentException(); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
return "/documentsBrowser.xhtml";
}
}
I have even add anotation to runtimeException:
@ApplicationException(rollback=true, end=true)
public class DocumentException extends RuntimeException {
}
Funny thing: If I Uncomment events code than no event is fired => Transaction is not successfull
And here are my logs (i have removed 80% of irrelevant lines and left only those that describe Phases, EntityManager and Transactions):
12:13:24,561 DEBUG [BaseFilter] Filter start request processing at 26.10.09 12:13 for uri: /DocFlow/documentEditorContent.seam
12:13:24,567 DEBUG [SeamPhaseListener] beginning transaction prior to phase: RESTORE_VIEW 1
12:13:24,568 DEBUG [UTTransaction] beginning JTA transaction
12:13:24,569 DEBUG [ProxyObjectFactory] org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory servicing request for DocFlow-ear/EjbSynchronizations/local
12:13:24,569 DEBUG [Ejb3McRegistrar] Returning from name "ProxyFactory/EjbSynchronizations/DocFlow-ear/EjbSynchronizations/local": org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionLocalProxyFactory@486fc1
12:13:24,575 DEBUG [SessionProxyObjectFactory] Created Proxy of type $Proxy352 for EJB3 Business Interface: org.jboss.seam.transaction.LocalEjbSynchronizations
12:13:24,577 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6
12:13:24,577 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:24,579 DEBUG [EjbSynchronizations] afterBegin
12:13:24,579 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:24,579 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@14da763, arguments=[Ljava.lang.Object;@3b1e79]
12:13:24,605 DEBUG [AjaxPhaseListener] Process before phase PROCESS_VALIDATIONS 3
12:13:24,610 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
12:13:24,610 DEBUG [JDBCContext] successfully registered Synchronization
12:13:24,611 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.registerSynchronization(javax.transaction.Synchronization)" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6
12:13:24,611 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:24,613 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:24,614 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.registerSynchronization(javax.transaction.Synchronization), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.registerSynchronization(javax.transaction.Synchronization), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.registerSynchronization(javax.transaction.Synchronization)]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@14da763, arguments=[Ljava.lang.Object;@15b86f5]
12:13:24,617 DEBUG [AjaxPhaseListener] Process after phase PROCESS_VALIDATIONS 3
12:13:24,619 DEBUG [AjaxPhaseListener] Process before phase UPDATE_MODEL_VALUES 4
12:13:24,624 DEBUG [AjaxPhaseListener] Process after phase UPDATE_MODEL_VALUES 4
12:13:24,625 DEBUG [AjaxPhaseListener] Process before phase INVOKE_APPLICATION 5
12:13:24,630 DEBUG [Component] trying to inject with hierarchical context search: entityManager
12:13:24,631 DEBUG [Component] trying to inject with hierarchical context search: events
12:13:24,632 DEBUG [AbstractFlushingEventListener] processing flush-time cascades
12:13:24,632 DEBUG [AbstractFlushingEventListener] dirty checking collections
12:13:24,664 DEBUG [Collections] Collection found: [pl.com.bottega.docflow.model.Document.assignedusers#1], was: [<unreferenced>] (initialized)
12:13:24,665 DEBUG [Collections] Collection dereferenced: [pl.com.bottega.docflow.model.Document.assignedusers#1]
12:13:24,687 DEBUG [AbstractFlushingEventListener] Flushed: 0 insertions, 1 updates, 0 deletions to 2 objects
12:13:24,687 DEBUG [AbstractFlushingEventListener] Flushed: 1 (re)creations, 0 updates, 1 removals to 2 collections
12:13:24,687 DEBUG [Printer] listing entities:
12:13:24,727 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
12:13:24,727 DEBUG [ConnectionManager] opening JDBC connection
12:13:24,728 DEBUG [SQL]
update
...
12:13:24,740 DEBUG [AbstractBatcher] Executing batch size: 1
12:13:24,825 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
12:13:24,825 DEBUG [ConnectionManager] skipping aggressive-release due to flush cycle
12:13:24,825 DEBUG [AbstractCollectionPersister] Deleting collection: [pl.com.bottega.docflow.model.Document.assignedusers#1]
12:13:24,826 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
12:13:24,826 DEBUG [SQL]
delete
from
...
12:13:24,827 DEBUG [AbstractCollectionPersister] done deleting collection
12:13:24,827 DEBUG [AbstractBatcher] Executing batch size: 1
12:13:24,828 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
12:13:24,828 DEBUG [ConnectionManager] skipping aggressive-release due to flush cycle
12:13:24,829 DEBUG [AbstractCollectionPersister] Inserting collection: [pl.com.bottega.docflow.model.Document.assignedusers#1]
12:13:24,829 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
12:13:24,829 DEBUG [SQL]
insert
...
12:13:24,830 DEBUG [AbstractCollectionPersister] done inserting collection: 1 rows inserted
12:13:24,830 DEBUG [AbstractBatcher] Executing batch size: 1
12:13:24,832 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
12:13:24,832 DEBUG [ConnectionManager] skipping aggressive-release due to flush cycle
12:13:24,832 DEBUG [ConnectionManager] aggressively releasing JDBC connection
12:13:24,832 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
12:13:24,837 DEBUG [Manager] Ending long-running conversation
12:13:24,838 ERROR [application] pl.com.bottega.docflow.application.DocumentException
javax.faces.el.EvaluationException: pl.com.bottega.docflow.application.DocumentException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 53 more
12:13:24,841 WARN [lifecycle] #{documentEditor.save}: pl.com.bottega.docflow.application.DocumentException
javax.faces.FacesException: #{documentEditor.save}: pl.com.bottega.docflow.application.DocumentException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
12:13:24,843 ERROR [lifecycle] JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /documentEditorContent.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@e5ebd5]
12:13:24,843 DEBUG [AjaxPhaseListener] Process after phase INVOKE_APPLICATION 5
12:13:24,845 DEBUG [ResourceLoader] resource bundle missing: documentEditorContent
12:13:24,848 DEBUG [SeamPhaseListener] rolling back transaction after phase: INVOKE_APPLICATION 5
12:13:24,850 DEBUG [UTTransaction] rolling back JTA transaction
12:13:24,851 DEBUG [EjbSynchronizations] afterCompletion
12:13:24,852 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionRollback()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6
12:13:24,852 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:24,853 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:24,853 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionRollback(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionRollback(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionRollback()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@14da763, arguments=[Ljava.lang.Object;@1985c76]
12:13:24,853 DEBUG [ExceptionFilter] handling uncaught exception
javax.servlet.ServletException: #{documentEditor.save}: pl.com.bottega.docflow.application.DocumentException
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 53 more
12:13:24,856 DEBUG [ExceptionFilter] running exception handlers
12:13:24,856 DEBUG [Lifecycle] After request, destroying contexts
12:13:24,857 DEBUG [Contexts] destroying business process context
12:13:24,857 DEBUG [Contexts] destroying conversation context
12:13:24,857 DEBUG [Contexts] destroying: org.jboss.seam.ui.EntityConverter
12:13:24,857 DEBUG [Contexts] destroying: documentEditor
12:13:24,857 DEBUG [Contexts] destroying: editedDocument
12:13:24,857 DEBUG [Contexts] destroying: org.jboss.seam.persistence.persistenceContexts
12:13:24,858 DEBUG [Contexts] destroying: org.jboss.seam.core.conversation
12:13:24,858 DEBUG [Contexts] destroying: org.jboss.seam.international.statusMessages
12:13:24,858 DEBUG [Contexts] destroying: entityManager
12:13:24,858 DEBUG [ManagedPersistenceContext] destroying seam managed persistence context for persistence unit: java:/DocFlowEntityManagerFactory
12:13:24,859 DEBUG [Contexts] flushing server-side conversation context
12:13:24,859 DEBUG [Contexts] flushing session context
12:13:24,860 DEBUG [Contexts] destroying event context
12:13:24,860 DEBUG [Contexts] destroying: com.sun.faces.util.RequestStateManager
12:13:24,860 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationPropagation
12:13:24,860 DEBUG [Contexts] destroying: org.jboss.seam.core.manager
12:13:24,860 DEBUG [Contexts] destroying: org.ajax4jsf.application.AjaxStateManager.AJAX_VIEW_SEQUENCE
12:13:24,860 DEBUG [Contexts] destroying: com.exade.vcp.Filter.done
12:13:24,860 DEBUG [Contexts] destroying: org.jboss.seam.transaction.transaction
12:13:24,860 DEBUG [Contexts] destroying: org.jboss.seam.faces.validation
12:13:24,860 DEBUG [Contexts] destroying: org.jboss.seam.transaction.synchronizations
12:13:24,861 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6: Current invocation "public abstract void org.jboss.seam.transaction.LocalEjbSynchronizations.destroy()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@19337e6
12:13:24,861 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:24,862 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:24,862 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.destroy(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.destroy(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.LocalEjbSynchronizations.destroy()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@14da763, arguments=[Ljava.lang.Object;@1de8244]
12:13:24,864 DEBUG [Contexts] destroying: org.jboss.seam.web.requestContextPath
12:13:24,864 DEBUG [Contexts] destroying: org.jboss.seam.web.servletContexts
12:13:24,864 DEBUG [Contexts] destroying: org.jboss.seam.web.requestServletPath
12:13:24,864 DEBUG [Contexts] destroying: org.jboss.seam.core.events
12:13:24,864 DEBUG [Contexts] destroying: ajaxContext
12:13:24,864 DEBUG [Contexts] destroying: com.exade.vcp.Filter.ResponseWrapper
12:13:24,864 DEBUG [Lifecycle] <<< End web request
12:13:24,884 DEBUG [FacesLifecycle] >>> Begin exception recovery
12:13:24,889 DEBUG [Manager] Restoring conversation with id: 3
12:13:24,895 DEBUG [Exceptions] reading exception mappings from /WEB-INF/pages.xml
12:13:24,948 DEBUG [Navigator] redirecting to: /error.xhtml
12:13:24,954 DEBUG [FacesManager] redirecting to: /DocFlow/error.seam?cid=3
12:13:24,956 ERROR [Exceptions] handled and logged exception
javax.servlet.ServletException: #{documentEditor.save}: pl.com.bottega.docflow.application.DocumentException
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
12:13:24,958 DEBUG [FacesLifecycle] After render response, destroying contexts
12:13:24,958 DEBUG [Contexts] flushing server-side conversation context
12:13:24,961 DEBUG [Contexts] flushing session context
12:13:24,962 DEBUG [Contexts] destroying event context
12:13:24,962 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationPropagation
12:13:24,962 DEBUG [Contexts] destroying: org.jboss.seam.transaction.transaction
12:13:24,962 DEBUG [Contexts] destroying: org.jboss.seam.core.manager
12:13:24,962 DEBUG [Contexts] destroying: org.jboss.seam.core.events
12:13:24,962 DEBUG [FacesLifecycle] <<< End JSF request for /DocFlow/documentEditorContent.seam
12:13:24,962 DEBUG [ExceptionFilter] done running exception handlers
12:13:24,963 DEBUG [BaseFilter] Finished request processing total time 402ms for uri: /DocFlow/documentEditorContent.seam
12:13:25,040 DEBUG [BaseFilter] Filter start request processing at 26.10.09 12:13 for uri: /DocFlow/error.seam
12:13:25,041 DEBUG [BaseFilter] Filter request output to XML
12:13:25,041 DEBUG [BaseXMLFilter] XML filter service start processing request
12:13:25,041 DEBUG [FacesLifecycle] >>> Begin JSF request for /DocFlow/error.seam
12:13:25,043 DEBUG [SeamPhaseListener] beginning transaction prior to phase: RESTORE_VIEW 1
12:13:25,043 DEBUG [UTTransaction] beginning JTA transaction
12:13:25,044 DEBUG [ProxyObjectFactory] org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory servicing request for DocFlow-ear/EjbSynchronizations/local
12:13:25,044 DEBUG [Ejb3McRegistrar] Returning from name "ProxyFactory/EjbSynchronizations/DocFlow-ear/EjbSynchronizations/local": org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionLocalProxyFactory@486fc1
12:13:25,046 DEBUG [SessionProxyObjectFactory] Created Proxy of type $Proxy352 for EJB3 Business Interface: org.jboss.seam.transaction.LocalEjbSynchronizations
12:13:25,046 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,047 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,047 DEBUG [EjbSynchronizations] afterBegin
12:13:25,047 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,047 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@346299]
12:13:25,048 DEBUG [AjaxPhaseListener] Process before phase RESTORE_VIEW 1
12:13:25,048 DEBUG [AjaxPhaseListener] Process after phase RESTORE_VIEW 1
12:13:25,049 DEBUG [Manager] Restoring conversation with id: 3
12:13:25,050 DEBUG [SeamPhaseListener] committing transaction after phase: RESTORE_VIEW 1
12:13:25,050 DEBUG [UTTransaction] committing JTA transaction
12:13:25,051 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.beforeTransactionCommit()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,051 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,051 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,051 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.beforeTransactionCommit(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.beforeTransactionCommit(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.beforeTransactionCommit()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@1f28052]
12:13:25,052 DEBUG [EjbSynchronizations] beforeCompletion
12:13:25,052 DEBUG [EjbSynchronizations] afterCompletion
12:13:25,052 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionCommit(boolean)" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,052 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,053 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,053 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionCommit(boolean), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionCommit(boolean), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionCommit(boolean)]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@1c6c91e]
12:13:25,054 DEBUG [SeamPhaseListener] beginning transaction prior to phase: RENDER_RESPONSE 6
12:13:25,054 DEBUG [UTTransaction] beginning JTA transaction
12:13:25,055 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,055 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,055 DEBUG [EjbSynchronizations] afterBegin
12:13:25,056 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,056 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionBegin(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionBegin()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@11573a]
12:13:25,058 DEBUG [AjaxPhaseListener] Process before phase RENDER_RESPONSE 6
12:13:25,059 DEBUG [AjaxPhaseListener] PhaseListener enter Before RenderView Phase with ViewId /error.xhtml and RenderKitId HTML_BASIC
12:13:25,061 DEBUG [viewhandler] Rendering View: /error.xhtml
12:13:25,061 DEBUG [viewhandler] ActionId -> ViewId: /error.xhtml -> /error.xhtml
12:13:25,061 DEBUG [viewhandler] Building View: /error.xhtml
12:13:25,169 DEBUG [AjaxPhaseListener] Process after phase RENDER_RESPONSE 6
12:13:25,170 DEBUG [SeamPhaseListener] committing transaction after phase: RENDER_RESPONSE 6
12:13:25,170 DEBUG [UTTransaction] committing JTA transaction
12:13:25,171 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.beforeTransactionCommit()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,171 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,172 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,172 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.beforeTransactionCommit(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.beforeTransactionCommit(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.beforeTransactionCommit()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@87fb2f]
12:13:25,172 DEBUG [EjbSynchronizations] beforeCompletion
12:13:25,173 DEBUG [EjbSynchronizations] afterCompletion
12:13:25,173 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.Synchronizations.afterTransactionCommit(boolean)" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,173 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,174 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,174 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionCommit(boolean), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.afterTransactionCommit(boolean), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.Synchronizations.afterTransactionCommit(boolean)]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@17c087b]
12:13:25,174 DEBUG [Manager] Storing conversation state: 3
12:13:25,174 DEBUG [FacesLifecycle] After render response, destroying contexts
12:13:25,175 DEBUG [Contexts] destroying business process context
12:13:25,175 DEBUG [Contexts] flushing server-side conversation context
12:13:25,175 DEBUG [Contexts] flushing session context
12:13:25,176 DEBUG [Contexts] destroying event context
12:13:25,176 DEBUG [Contexts] destroying: com.sun.faces.util.RequestStateManager
12:13:25,176 DEBUG [Contexts] destroying: org/richfaces/renderkit/html/scripts/skinning.js
12:13:25,176 DEBUG [Contexts] destroying: org.ajax4jsf.framework.HEAD_EVENTS_LIST
12:13:25,176 DEBUG [Contexts] destroying: org.ajax4jsf.framework.HEADER_PROCESSED
12:13:25,176 DEBUG [Contexts] destroying: org.ajax4jsf.captured_view_state
12:13:25,176 DEBUG [Contexts] destroying: org.jboss.seam.core.manager
12:13:25,176 DEBUG [Contexts] destroying: org/richfaces/renderkit/html/css/extended_classes.xcss
12:13:25,176 DEBUG [Contexts] destroying: facelets.ContentType
12:13:25,176 DEBUG [Contexts] destroying: org.jboss.seam.transaction.synchronizations
12:13:25,177 DEBUG [ProxyInvocationHandlerBase] Couldn't handle invocation directly within org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2: Current invocation "public abstract void org.jboss.seam.transaction.LocalEjbSynchronizations.destroy()" is not eligible for direct handling by org.jboss.ejb3.proxy.handler.session.stateful.StatefulLocalProxyInvocationHandler@1a1bfc2
12:13:25,177 DEBUG [Ejb3McRegistrar] Returning from name "jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3": jboss.j2ee:ear=DocFlow-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
12:13:25,177 DEBUG [ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor
12:13:25,178 DEBUG [InterceptorSequencer] aroundInvoke [advisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.destroy(), unadvisedMethod=public void org.jboss.seam.transaction.EjbSynchronizations.destroy(), metadata=[metaData={SessionInvocation={InvokedMethod=[type=MARSHALLEDvalue=org.jboss.seam.transaction.LocalEjbSynchronizations: org.jboss.seam.transaction.LocalEjbSynchronizations.destroy()]}}], targetObject=org.jboss.seam.transaction.EjbSynchronizations@1353425, arguments=[Ljava.lang.Object;@10d77d]
12:13:25,180 DEBUG [Contexts] destroying: org.ajax4jsf.javascript.AjaxScript
12:13:25,204 DEBUG [FacesLifecycle] <<< End JSF request for /DocFlow/error.seam -
6. Re: Manual flushing peristence context & NO transaction rollback
kapitanpetko Oct 27, 2009 2:44 AM (in response to slaweksss)It seems the transaction is being rolled back after all:
12:13:24,843 DEBUG [AjaxPhaseListener] Process after phase INVOKE_APPLICATION 5 12:13:24,845 DEBUG [ResourceLoader] resource bundle missing: documentEditorContent 12:13:24,848 DEBUG [SeamPhaseListener] rolling back transaction after phase: INVOKE_APPLICATION 5 12:13:24,850 DEBUG [UTTransaction] rolling back JTA transaction
So most likely some problem with your setup, than a problem in Seam. Do you have <transaction:ejb-transaction /> in components.xml?
-
7. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Oct 27, 2009 7:44 PM (in response to slaweksss)Yes, sure...
Here is my components.xml (important lines), persistence.xml and data source - all generated by JBoss Tools (but I had to add ejb-transaction manually!):
What potentially may be screwed up? Where to start digging?
<components ...>
<core:init debug="false" jndi-pattern="@jndiPattern@"/>
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"
parent-conversation-id-parameter="pid"/>
<web:hot-deploy-filter url-pattern="*.seam"/>
<web:rewrite-filter view-mapping="*.seam"/>
<persistence:managed-persistence-context name="entityManager" auto-create="true"
persistence-unit-jndi-name="java:/DocFlowEntityManagerFactory"/>
<transaction:ejb-transaction />
</components>
<persistence ...>
<persistence-unit name="DocFlow" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>DocFlowDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/DocFlowEntityManagerFactory"/>
</properties>
</persistence-unit>
</persistence>
<datasources>
<local-tx-datasource>
<jndi-name>DocFlowDatasource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://localhost:3306/docflow</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
</local-tx-datasource>
</datasources> -
8. Re: Manual flushing peristence context & NO transaction rollback
kapitanpetko Oct 28, 2009 3:29 AM (in response to slaweksss)The only differences with my setup (and Seam examples) is this property in persistence.xml. Try adding it.
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
And, the <jta-data-source> value has the java:/ prefx. Try it with:
<jta-data-source>java:/DocFlowDatasource</jta-data-source>
If that fails try comparing your setup with the Seam booking example (*.xml files).
-
9. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Oct 30, 2009 11:51 AM (in response to slaweksss)I nave added property and changed jndi name - doesn't help:/
Thanks for suggestions, i'll digg deeper in free time... -
10. Re: Manual flushing peristence context & NO transaction rollback
cash1981 Oct 30, 2009 11:22 PM (in response to slaweksss)Are you sure your entityManager is in a managed state? Correct me if I am wrong, but I think only managed entityManager will rollback for you, however, if you have a unmanaged entityManager, you will have to manually rollback the transaction your self.
-
11. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Oct 31, 2009 1:06 PM (in response to slaweksss)Hi Shervin
What exactly do You mean by "managed Entiy Manager state"?
If it means "managed by Seam" than I think it is so...
I have declared special component that wraps JBoss Managed Persistence Factory by Seam wrapper:
<persistence:managed-persistence-context name="entityManager" auto-create="true"
persistence-unit-jndi-name="java:/DocFlowEntityManagerFactory"/>
and I'm injecting EntityManager to POJOs and EJBs by @In -
12. Re: Manual flushing peristence context & NO transaction rollback
yasudevil Jan 28, 2010 12:19 PM (in response to slaweksss)I have a similar problem, did you found any solution?
-
13. Re: Manual flushing peristence context & NO transaction rollback
slaweksss Jan 28, 2010 3:10 PM (in response to slaweksss)No I did not found solution yet...
But I suppose that upcoming Spring 3.1 will be perfect solution;P -
14. Re: Manual flushing peristence context & NO transaction rollback
yasudevil Jan 28, 2010 4:56 PM (in response to slaweksss)Geez, that's terrible, maybe we are using in the wrong manner...
I'm starting to wonder if I'm using JPA the right way.
But i've been reading the Seam in Action book and unless I misunderstood the chapter even when you flush the entityManager it doesn't commits the transaction.