1 Reply Latest reply on Mar 2, 2007 7:11 AM by Mariusz Smykula

    optimistic locking - exception handling

    pis ta Newbie

      hi folks,

      i'm trying to use optimistic locking with seam, everything works fine
      except very last thing, when i'm trying to save the record (that was changed by other user) i'll get page that user can't really understand (server internal error).

      In jboss log i see exception(explainig problem), but at the end it comes to java.lang.NoClassDefFoundError, see log:

      11:30:50,734 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [c
      om.arnie.panta.PrProdukt#21]
      at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1699)
      ....
      11:30:50,748 ERROR [ExceptionFilter] uncaught exception
      javax.servlet.ServletException: Error calling action method of component with id prProdukt:update
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
      ...
      11:30:50,748 ERROR [ExceptionFilter] exception root cause
      javax.faces.FacesException: Error calling action method of component with id prProdukt:update
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
      ...
      Caused by: javax.faces.el.EvaluationException: /PrProduktEdit.xhtml @110,61 action="#{prProduktHome.update}": javax.persistence.Optimis
      ticLockException
      at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
      ....
      Caused by: javax.persistence.OptimisticLockException
      at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:604)
      ...
      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was inc
      orrect): [com.arnie.panta.PrProdukt#21]
      at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1699)
      ....
      11:30:50,753 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NoClassDefFoundError: com/sun/facelets/el/LegacyELContext
      at org.jboss.seam.web.ExceptionFilter.createFacesContext(ExceptionFilter.java:122)
      ...

      please give me advice how to handle this exception and show up friendly message to user on formular page.

      thanks

      pista


      page i get:
      ---------------

      HTTP Status 500 -

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Filter execution threw an exception
      org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
      org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      java.lang.NoClassDefFoundError: com/sun/facelets/el/LegacyELContext
      org.jboss.seam.web.ExceptionFilter.createFacesContext(ExceptionFilter.java:122)
      org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:86)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:73)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
      org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
      org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.