My doFilter method looks like that: public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { arg2.doFilter(arg0,arg1); try{ HibernateSessionFactory.commitTransaction(); System.out.println("koniec"); }catch(DAOException e){ throw new ServletException(e); }finally{ HibernateSessionFactory.closeSession(); } }
My problem is that although DAOException is being catched and new ServletException is being thrown the page is already rendered. There is no error on the page and the only place where I can find that something went wrong is server log. What is wrong? Why ServletException doesn't affect page?
Did you mean to send this to the tomcat-user list? I think you're more likely to get a good technical answer there. Firstly I'd check that you're actually going thro the filter where you think you are. Secondly I'd check the servlet spec to see what is actually meant to happen when a filter throws an exception.
Presumably you never see the 'koniec' output?
Perhaps hibernate throws a different exception that your not catching.
Also your call to arg2.doFilter might actually commit the response before the exception, allowing no chance for the exception to affect the response.
HTH Adam
-- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]