0 Replies Latest reply on Jan 27, 2012 1:08 PM by kelly goedert

    error pages WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped

    kelly goedert Apprentice

      Hi,


      I want to have custom error pages for 404 errors and for 500 errors. So I added to my web.xml the following




      <?xml version="1.0" encoding="UTF-8" ?>
      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
      
              <context-param>
                      <param-name>javax.faces.PROJECT_STAGE</param-name>
                      <param-value>Development</param-value>
              </context-param>
      
              <context-param>
                      <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
                      <param-value>true</param-value>
              </context-param>
      
              <context-param>
                      <param-name>primefaces.THEME</param-name>
                      <param-value>sam</param-value>
              </context-param>
      
              <context-param>
                      <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
                      <param-value>true</param-value>
              </context-param>
      
              <context-param>
                      <param-name>facelets.DEVELOPMENT</param-name>
                      <param-value>true</param-value>
              </context-param>
      
              <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>
      
              <listener>
                      <listener-class>my.domain.listeners.AgendadorListener</listener-class>
              </listener>
      
              <welcome-file-list>
                      <welcome-file>index.xhtml</welcome-file>
              </welcome-file-list>
              
              <error-page>
                      <error-code>404</error-code>
                      <location>/myapp/error/index.xhtml</location>
              </error-page>
      
      </web-app>



      If I type localhost:8080/myapp/someDirThatDoesntExist or localhost:8080/myapp/someDirThatDoesntExist.xhtml I get




      java.lang.IllegalStateException: Could not wrap ExternalContext
              at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:47) [:3.0.2.Final]
              at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:89) [:2.0.3-]
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:298) [:2.0.3-]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:543) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:529) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:455) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:196) [:6.1.0.Final]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]
              at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]
      Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:667) [:6.1.0.Final]
              at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:77) [:6.1.0.Final]
              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87) [:6.1.0.Final]
              at org.jboss.seam.faces.environment.SeamExternalContext$Proxy$_$$_WeldClientProxy.setWrapped(SeamExternalContext$Proxy$_$$_WeldClientProxy.java) [:3.0.2.Final]
              at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:43) [:3.0.2.Final]
              ... 20 more
      
      15:07:39,735 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] Exception Processing ErrorPage[errorCode=404, location=/ccm/error/index.xhtml]: java.lang.IllegalStateException: Could not wrap ExternalContext
              at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:47) [:3.0.2.Final]
              at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:89) [:2.0.3-]
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:298) [:2.0.3-]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:543) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.1.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:529) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:455) [:6.1.0.Final]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:196) [:6.1.0.Final]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]
              at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]
      Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:667) [:6.1.0.Final]
              at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:77) [:6.1.0.Final]
              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87) [:6.1.0.Final]
              at org.jboss.seam.faces.environment.SeamExternalContext$Proxy$_$$_WeldClientProxy.setWrapped(SeamExternalContext$Proxy$_$$_WeldClientProxy.java) [:3.0.2.Final]
              at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:43) [:3.0.2.Final]
              ... 20 more




      Can somebody help?


      Thanks


      Kelly