4 Replies Latest reply on Nov 29, 2011 1:22 PM by Jason Porter

    404 Handling With Seam Catch - 3.1.0.Beta5

    Scott Basinger Newbie

      What is the recommended way to handle invalid page requests?  e.g. localhost:8080/myseamwebapp/somepagethatdoesntexist.xhtml?  With no seam catch handler, I end up getting the Cannot Start Transaction error after about 5 minutes.

        • 1. Re: 404 Handling With Seam Catch - 3.1.0.Beta5
          Jason Porter Master

          I'd need to see a stack trace to really help out.


          What happens if you setup error pages in the web.xml?

          • 2. Re: 404 Handling With Seam Catch - 3.1.0.Beta5
            Scott Basinger Newbie
            07:21:24,303 FATAL [org.jboss.seam.faces.view.SeamViewMetadata] (http--127.0.0.1-8080-2) java.io.FileNotFoundException: /badrequest.xhtml Not Found in ExternalContext as a Resource
            07:21:24,310 WARN  [org.jboss.solder.exception.control.log] (http--127.0.0.1-8080-2) No handlers found for exception javax.faces.FacesException: java.io.FileNotFoundException: /badrequest.xhtml Not Found in ExternalContext as a Resource
            07:21:24,312 WARN  [org.jboss.solder.exception.control.log] (http--127.0.0.1-8080-2) No handlers found for exception java.io.FileNotFoundException: /badrequest.xhtml Not Found in ExternalContext as a Resource
            07:21:24,313 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/golfplus].[Faces Servlet]] (http--127.0.0.1-8080-2) Servlet.service() for servlet Faces Servlet threw exception: javax.enterprise.event.ObserverException
                    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_22]
                    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [:1.6.0_22]
                    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [:1.6.0_22]
                    at java.lang.reflect.Constructor.newInstance(Unknown Source) [:1.6.0_22]
                    at java.lang.Class.newInstance0(Unknown Source) [:1.6.0_22]
                    at java.lang.Class.newInstance(Unknown Source) [:1.6.0_22]
                    at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:395) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:216) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:390) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:92) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:214) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:74) [solder-impl-3.1.0.Beta5.jar:]
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.1.0.Beta5.jar:]
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at java.lang.Thread.run(Unknown Source) [:1.6.0_22]
            Caused by: java.io.FileNotFoundException: /badrequest.xhtml Not Found in ExternalContext as a Resource
                    at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:224) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:265) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:201) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at org.jboss.seam.faces.view.SeamViewMetadata.createMetadataView(SeamViewMetadata.java:63) [seam-faces-3.1.0.Beta5.jar:]
                    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:227) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:111) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) [prettyfaces-jsf2-3.3.0.jar:]
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                    at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Beta5.jar:]
                    ... 18 more

            07:26:24,303 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA12117: TransactionReaper::check timeout for TX 0:ffffc0a80164:-9e11a04:4ed4ce2e:19 in state  RUN
            07:26:24,303 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA12095: Abort of action id 0:ffffc0a80164:-9e11a04:4ed4ce2e:19 invoked while multiple threads active within it.
            07:26:24,303 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA12108: CheckedAction::check - atomic action 0:ffffc0a80164:-9e11a04:4ed4ce2e:19 aborting with 1 threads active!
            07:26:24,303 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA12121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffc0a80164:-9e11a04:4ed4ce2e:19



            and here is the 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_3_0.xsd"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
                    <display-name>golfplus</display-name>

                    <!-- Set project stage to Production for production deployments!! Production mode also allows all exceptions to propagate to Seam Catch -->
                    <context-param>
                            <param-name>javax.faces.PROJECT_STAGE</param-name>
                            <param-value>Development</param-value>
                    </context-param>
                    <context-param>
                            <param-name>primefaces.THEME</param-name>
                            <param-value>dark-hive</param-value>
                    </context-param>

                    <session-config>
                            <session-timeout>6</session-timeout>
                    </session-config>

                    <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>*.xhtml</url-pattern>
                    </servlet-mapping>

                    <error-page>
                            <error-code>404</error-code>
                            <location>/error.html</location>
                    </error-page>
            </web-app>
            • 3. Re: 404 Handling With Seam Catch - 3.1.0.Beta5
              Scott Basinger Newbie

              When I take the facesservlet mapping out and map to .jsf instead of .xhtml then the 404 page comes up ok.  So maybe it's just a matter of getting the correct servlet-mapping?

              • 4. Re: 404 Handling With Seam Catch - 3.1.0.Beta5
                Jason Porter Master

                That could be. I'm pretty sure we don't have anything in Faces that will push to Catch at the right time to handle the redirect. It's a good feature request though. It probably won't make it for 3.1.0 however. Please add a JIRA regardless.