0

How to catch all Exceptions?

asked 2009-04-10 20:27:41 +0800

dastultz gravatar image dastultz
797 9

Hello,

I develop apps in Richlet/Java. I have defined an error page in zk.xml like so:

<error-page>
   <exception-type>java.lang.Throwable</exception-type>
   <location>CriticalError.zk</location>
</error-page>

Somehow I have managed to get a 500 error from Tomcat for an uncaught exception. How did this happen? I thought the error page should be used instead.

For interest, I tried to do something silly like add a Menuitem directly to a Menu in a Listitem of a Listbox. I got this error:

org.zkoss.zk.ui.UiException: Unsupported child for menu: <Menuitem null>
	org.zkoss.zul.Menu.insertBefore(Menu.java:110)
	org.zkoss.zk.ui.AbstractComponent.appendChild(AbstractComponent.java:1032)
	sanitized.Publish$4.createCellComponent(Publish.java:208)
	sanitized.renderCell(AbstractListTableCellRenderer.java:18)
	sanitized.render(ListTableRowRenderer.java:96)
	org.zkoss.zul.Listbox$Renderer.render(Listbox.java:2289)
	org.zkoss.zul.Listbox.onInitRender(Listbox.java:2179)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:585)
	org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:211)
	org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:143)
	org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:488)
	org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:422)

Of course I know what's causing the crash but I can't figure out why it isn't handled by the error page. I can't even get a breakpoint at Publish.java:208 to catch the debugger.

Thanks for any insight.

/Daryl

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2009-04-13 12:45:03 +0800

dastultz gravatar image dastultz
797 9

It turns out I needed error-page in web.xml, too. My service method is catching everything but the error is happening in an event thread so I thought the zk.xml error-page would handle it.

/Daryl

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-04-10 20:27:41 +0800

Seen: 303 times

Last updated: Apr 13 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More