3 Replies Latest reply on Nov 6, 2007 8:18 PM by Jake C

    Can't intercept FileUploadException in 4.0.5 after adding to

    Jake C Newbie

      I added FileUploadException to org.jboss.seam.web and modified MultipartRequest to throw it instead of RuntimeException, but I still get a 500 error:

      13:00:11,221 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      org.jboss.seam.web.FileUploadException: Multipart request is larger than allowed size
       at org.jboss.seam.web.MultipartRequest.<init>(MultipartRequest.java:282)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:74)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:619)

      I've added the following to pages.xml:
      <exception class="org.jboss.seam.web.FileUploadException">
       <redirect view-id="/error.xhtml">
       <message>File is too big</message>
       </redirect>
       </exception>

      I have another exception handler that works just fine. When it occurs first, I see a debug message from org.jboss.seam.core.Exceptions that it is reading pages.xml, but I do NOT get that message when FileUploadException gets thrown first. Somehow, it seems like the ExceptionFilter is not in the filter chain that MultipartFilter is in. Isn't it supposed to be installed automatically, or is that just in 5.0? I certainly didn't add ExceptionFilter to web.xml to get it working for the exception that we have working, and I didn't have to add MultipartFilter to web.xml to get file uploads to work. However, just in case, I tried adding the following to web.xml after the Seam Filter filter-mapping tag:
      <filter>
       <filter-name>Seam Exception Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>Seam Exception Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <filter>
       <filter-name>Seam Multipart Filter</filter-name>
       <filter-class>org.jboss.seam.web.MultipartFilter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>Seam Multipart Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>

      Still no love. I can't get the ExceptionFilter to engage in exceptions from MultipartFilter. What am I missing?

        • 1. Re: Can't intercept FileUploadException in 1.2.1 with update
          Jake C Newbie

          Sorry. Of course, 4.0.5 is the JBOSS version. I mean Seam 1.2.1.

          OK, I think I see why the ExceptionFilter doesn't catch this. MultipartFilter is annotated with @Intercept(NEVER).

          I'm sure this is there for a very good reason. If I remove it, I get the following exception:

          14:13:33,015 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          java.lang.IllegalAccessException: Class org.jboss.seam.util.Reflections can not access a member of class org.jboss.seam.web.AbstractFilter with modifi
          ers ""
           at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
           at java.lang.reflect.Method.invoke(Method.java:588)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
           at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:113)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
           at org.jboss.seam.web.MultipartFilter_$$_javassist_13.matchesRequestPath(MultipartFilter_$$_javassist_13.java)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:47)
           at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
           at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:619)

          Is it possible to get exception handling to work with MultipartRequest?

          • 2. Re: Can't intercept FileUploadException in 1.2.1 after addin
            Jake C Newbie

            No takers?

            Was the <s:fileUpload> tag really created with a way to limit the file size, but no way to capture the 500 error that is generated by doing so?

            • 3. Re: Can't intercept FileUploadException in 4.0.5 after addin
              Jake C Newbie

              I've created a new Topic, since I really messed up the Subject of this one.

              <s:fileUpload> and "maxRequestSize" exceptions in 1.2.1
              http://www.jboss.com/index.html?module=bb&op=viewtopic&t=123127