简体   繁体   中英

Websphere Portal portlet doesn't fail after an exception and refires all events on reload

I am developing an application and normally portlets, in which a runtime exception occurs (such as null pointer exception), will be replaced (on page render/reload) with a small box with the message "Portlet temporarily disabled". But somehow my application doesn't fails on uncaught errors, but rather renders the page as if nothing was wrong (while spitting huge stack traces into console). You might be wondering why this is bad.

I've made an error in a button action method, which resulted in NullPointerException when a certain input field was empty. Further on in this action method some info was inserted into the DB. The web form silently failed, which is why I pressed the button a couple more times. Then I entered data in input field and pressed the button one more time. Now the action handler method doesn't throw the NullPointerException anymore.

However what happened is that handler method ran 6 times (once for each failed submit + 1). Obviously, ActionEvent s which resulted in NullPointerException didn't get removed from the action queue and they got refired on subsequent request. This is not a problem if application did get disabled as it's supposed to.

Can anyone help me with this? I need to either get portlets failing again on uncaught exceptions or some way to clear faces event queues after each render respons phase.

  1. Put a breakpoint where the NPE actually occurs.
  2. Start server in debug mode.
  3. When the server stops on the breakpoint, look at the stack and see the chain of calls. Something might be "swallowing" your NPE.

Such a thing would normally happen when you develop against a custom-designed Portlet development framework. A design flaw in that framework might lead to improper exception handling of actions. I have seen such custom frameworks before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM