-
1. Re: OptimisticLockException
pmuir Jan 25, 2007 6:12 AM (in response to vk101)As mentioned in the manual, @Redirect and @Render don't work for certain phases of the JSF lifecycle. WHich are you using?
-
2. Re: OptimisticLockException
vk101 Jan 25, 2007 12:05 PM (in response to vk101)I was using @Render, I'll try using @Redirect instead. I'm guessing @Render would've been preferrable so that the error appears on the same page rather than (like a FacesMessage from an invalid field)
Why do @Render (only in INVOKE_APPLICATION) and @Redirect (not in RENDER_RESPONSE) not work at any time in the request lifecycle? Can't redirects and forwards happen at any time? (I'm sure there's a good reason, maybe someone could explain.) -
3. Re: OptimisticLockException
gavin.king Jan 25, 2007 1:06 PM (in response to vk101)Nope, as soon as you do something to the servlet response object, you can't change your mind later and do something else.
However, I don't quite recall why I decided that you couldn't use @Render during the PROCESS_VALIDATIONS and UPDATE_MODEL_VALUES phases. There was probably some reason why this didn't work, but its possibly an oversight. Perhaps you want to experiment with the changing the Seam code and see if I got this wrong.... -
4. Re: OptimisticLockException
vk101 Jan 25, 2007 6:33 PM (in response to vk101)Changing exceptions.xml to redirect from render doesn't do anything - same problem. This exception is getting caught somewhere and not propagating to a point where exceptions.xml can do anything with it.
What am I supposed to do here? (Short of creating an action method - see my OP.) -
5. Re: OptimisticLockException
vk101 Jan 25, 2007 6:53 PM (in response to vk101)In the log, the OptimisticLockException (OLE) shows up somewhere between the following two statements:
[SeamPhaseListener] after phase: INVOKE_APPLICATION(5) #Several other statements here #The exception stack traces followed immediately by the next line: [SeamPhaseListener] before phase: RENDER_RESPONSE(6)
Also, the OLE is caused by a org.hibernate.StaleObjectStateException. The OLE causes org.jboss.tm.JBossRollbackException which then causes java.lang.IllegalStateException. I try catching all of them in exceptions.xml, but none of them work!<exceptions> <exception class="org.hibernate.StaleObjectStateException"> <redirect>optimistic lock exception</redirect> </exception> </exceptions>
-
6. Re: OptimisticLockException
vk101 Jan 26, 2007 12:57 PM (in response to vk101)Is my only option then to use an action method? It seems like an ugly solution but the only thing I can think of...am I missing any possibilities?
-
7. Re: OptimisticLockException
vk101 Feb 1, 2007 2:08 AM (in response to vk101)In cases like this where an OptimisticLockException occurs, does Seam have no way of using exceptions.xml to handle this fact and display a nice error message?
I've exhausted all my resources and don't know where else to turn apart from this board...please, if somebody knows how to use exceptions.xml to catch it, let me know...
If you need any more info on the issue, I can provide it...
Thanks. -
8. Re: OptimisticLockException
gavin.king Feb 1, 2007 3:42 AM (in response to vk101)Nope, Seam cant do much about exceptions which occur at this point. As I've said here many times, JSF exception handling sucks ass, your only option is to beg for proprietary features from the JSF implementations.
If you read the JSF spec, it actually says explicitly that JSF implementations should swallow and ignore exceptions that occur in phase listeners. -
9. Re: OptimisticLockException
gavin.king Feb 1, 2007 3:55 AM (in response to vk101)Actually, that's not quite right. There probably is something we can do to allow these exceptions to be handled in exceptions.xml. Will be messy, but possible.
http://jira.jboss.org/jira/browse/JBSEAM-748