6 Replies Latest reply on Mar 11, 2010 11:24 AM by kenfrommera

    Strange behavior of custom error page

      Hello,


      I'm trying to create custom error page which should work as all other JSFs in my application.
      I have the following web.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
           id="WebApp_ID" version="2.5">
      
           <display-name>myWebApp</display-name>
      
           <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
           </welcome-file-list>
      
           <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
           </servlet>
           <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.seam</url-pattern>
           </servlet-mapping>
           <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
           </servlet>
           <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
           </servlet-mapping>
      
           <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
           </listener>
      
           <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
           </filter>
           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
                <dispatcher>ERROR</dispatcher>
                <dispatcher>FORWARD</dispatcher>
                <dispatcher>REQUEST</dispatcher>
           </filter-mapping>
      
           <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
           </context-param>
           <context-param>
                <param-name>org.richfaces.SKIN</param-name>
                <param-value>blueSky</param-value>
           </context-param>
      
           <security-constraint>
                <display-name>Restrict raw XHTML Documents</display-name>
                <web-resource-collection>
                     <web-resource-name>XHTML</web-resource-name>
                     <url-pattern>*.xhtml</url-pattern>
                </web-resource-collection>
                <auth-constraint />
           </security-constraint>
      
           <error-page>
                <error-code>404</error-code>
                <location>/error.seam</location>
           </error-page>
      
      </web-app>
      



      Error.seam corresponds to error.xhtml page which is quite simple (I think there is no reason to show its code here).


      Well, such configuration work fine when I try URLs like


      http://my_server/my_app/some_folder/
      http://my_server/my_app/some_folder/test.html
      



      But it fails with JBoss Seam Debug Page when I try to access any non-existing page with URL like


      http://my_server/my_app/some_folder/anything_with.seam
      



      Here is the stack trace:


      Caused by javax.ejb.NoSuchEJBException with message: Could not find stateful bean: aa14v-tl6nz1-g0568imr-1-g058ldde-2p


      org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:390)
      org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:375)
      org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:61)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
      org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
      $Proxy288.beforeTransactionCommit(Unknown Source)
      sun.reflect.GeneratedMethodAccessor246.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
      org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
      org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      org.javassist.tmp.java.lang.Object_$$_javassist_seam_1.beforeTransactionCommit(Object_$$_javassist_seam_1.java)
      org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:49)
      org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613)
      org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:604)
      org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:345)
      org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:245)
      org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196)
      com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
      com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:63)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
      org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      org.jboss.seam.web.RewriteFilter.process(RewriteFilter.java:98)
      org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:57)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
      org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:423)
      org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) java.lang.Thread.run(Unknown Source)
      




      So, .seam at the end spoils everything.



      Frankly speaking, I have no idea why it happens. Can anyone give me a hand?

        • 1. Re: Strange behavior of custom error page

          No ideas either?


          Well, I changed


          <servlet-mapping>
               <servlet-name>Faces Servlet</servlet-name>
               <url-pattern>*.seam</url-pattern>
          </servlet-mapping>
          



          to


          <servlet-mapping>
               <servlet-name>Faces Servlet</servlet-name>
               <url-pattern>/seam/*</url-pattern>
          </servlet-mapping>
          



          and also updated the components.xml accordingly.


          Now I receive the same stack trace when trying to open any non-existing resource with URL
          like:


          http://my_host:8080/my_app/seam/anything



          Probably, it is not misconfiguration in my application, but Seam bug.


          Seam-guys, what do you think?

          • 2. Re: Strange behavior of custom error page

            OK, let it be JBSEAM-4431.

            • 3. Re: Strange behavior of custom error page
              javri28.giorgijavrishvili.hotmail.com

              Hi,


              I'm facing the same problem.
              Unfortunately I couldn't find Jira Issue JBSEAM-4431.


              Did you find any solution?


              Many thanks,


              giorgi

              • 4. Re: Strange behavior of custom error page

                Giorgi Javrishvili wrote on Nov 19, 2009 13:04:


                Hi,

                I'm facing the same problem.
                Unfortunately I couldn't find Jira Issue JBSEAM-4431.


                Hi Giorgi


                Sorry for delay, I just mentioned your reply.


                No, I did not find any solution.


                As for Jira Issue, at first it was rejected with suggestion to use Seam forum to find the solution.
                I re-opened it providing the link to this forum and after that it was simply deleted without any explanation.

                • 5. Re: Strange behavior of custom error page
                  cash1981

                  Probably the reason why it got deleted is because there is no bug in Seam in this issue. From what I can see in the behavior you are explaining, it is clearly something wrong in your code.


                  You haven't showed the reason for the stacktrace. It seems like seam is trying to load a class, and that is not his own class, but yours it seems.
                  When I visit a page that doesnt exist, I get error message. Not stacktrace.

                  • 6. Re: Strange behavior of custom error page

                    Shervin Asgari wrote on Mar 10, 2010 22:42:

                    Probably the reason why it got deleted is because there is no bug in Seam in this issue.

                    It should not be deleted in any case: No trouble found or Not reproducible states (I believe such states are available in Jira) should be used for such issues.



                    Shervin Asgari wrote on Mar 10, 2010 22:42:

                    From what I can see in the behavior you are explaining, it is clearly something wrong in your code.


                    I do not have any code .


                    I just try to see 404 error page for non-existing resource.


                    And it works for URLs like


                    http://my_server/my_app/some_folder/
                    http://my_server/my_app/some_folder/test.html



                    But fails if I try to access any non-existing resource with URL like


                    http://my_server/my_app/some_folder/anything_with.seam




                    Shervin Asgari wrote on Mar 10, 2010 22:42:

                    You haven't showed the reason for the stacktrace. It seems like seam is trying to load a class, and that is not his own class, but yours it seems.

                    My classes are not mentioned in the stack trace at all.
                    Please, see Jarkko Miettinen's full stack trace here.



                    Shervin Asgari wrote on Mar 10, 2010 22:42:

                    When I visit a page that doesnt exist, I get error message. Not stacktrace.

                    Please, make sure that you get 404 error page, not general error page processed by the following directive


                    <exception>
                         <redirect view-id="/error.xhtml">
                              <message severity="error">Unexpected error, please try again</message>
                         </redirect>
                    </exception>