[jboss-user] [JBoss Seam] - Re: RuntimeException using @Pattern

vlaugier do-not-reply at jboss.com
Mon Oct 22 08:05:57 EDT 2007


Hello,

my experience

I have also meet the invalidStateException with a non required email field

The field is an email field with a @Email annotation in the entityBean and a s:validateAll in the form

If I submit the form with an invalid email pattern I receive a nice jsf error message as expected

if I submit the form without completing the email field, I receive the debug page and the invalidStateException.


  | Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
  |        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1394)
  |        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
  |        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
  |        at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
  |        ... 84 more
  | Caused by: javax.persistence.PersistenceException: org.hibernate.validator.InvalidStateException: validation failed for: fr.helmet.portal.entity.Account
  |        at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:527)
  |        at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
  |        at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
  |        at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
  |        at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
  |        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1382)
  |        ... 87 more
  | Caused by: org.hibernate.validator.InvalidStateException: validation failed for: fr.helmet.portal.entity.Account
  |        at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:143)
  |        at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:167)
  |        at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:156)
  |        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:49)
  |        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
  |        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
  |        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
  |        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
  |        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
  |        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
  |        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
  |        at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
  |        ... 92 more
  | 11:17:58,324 ERROR [ExceptionFilter] exception root cause
  | javax.faces.FacesException: #{accountManager.registerClient}: java.lang.RuntimeException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
  |        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
  |        at javax.faces.component.UICommand.broadcast(UICommand.java:383)
  |        at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
  |        at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
  |        at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
  |        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
  |        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
  |        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
  |        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
  |        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChai
  | 


What I have done is tansform the attribute in a null attribute if it has been set to an empty string in the form. This is done before persisting :

  | if (this.getAccount().getEmail().equalsIgnoreCase("")) this.getAccount().setEmail(null);
  | 

I still do not quite undertsand what is going on but at least it works

Cheers

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097425#4097425

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097425



More information about the jboss-user mailing list