My Oracle Support Banner

WELD-001303 Exception When CDI Managed Bean Is Accessed From Facelets Error Page (Doc ID 1604350.1)

Last updated on APRIL 12, 2018

Applies to:

Oracle WebLogic Server - Version 12.1.1.0 and later
Information in this document applies to any platform.

Symptoms

A Web / JSF application is deployed into 12.1.1 WLS server.
This application  has a facelet page (error.xhtml) configured in web.xml descriptor  as error page :

<web-app ..>
..
    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/faces/error.xhtml</location>
    </error-page>
..
</web-app> 

 

This error page  (error.xhtml) is using a CDI bean (sessionScopedBean)  :

<h:body>
        <h1>You are now on the error page</h1>
        Current milliseconds: #{sessionScopedBean.milliseconds}
    </h:body>

   

The SessionScopedBean bean  is defined as the following :

@Named
@SessionScoped
public class SessionScopedBean implements Serializable {

    public long getMilliseconds() {
        return System.currentTimeMillis();
    }
}

 

The issue is that when invoking this error page ,
the cdi bean cannot be used , the following exception is thrown :

javax.servlet.ServletException: WELD-001303 No active contexts for scope type javax.enterprise.context.SessionScoped
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
  Truncated. see log file for complete stacktrace
Caused By: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.SessionScoped
  at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:612)
  at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:71)
  at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
  at nl.rensvanleeuwen.bean.SessionScopedBean$Proxy$_$$_WeldClientProxy.getMilliseconds(SessionScopedBean$Proxy$_$$_WeldClientProxy.java)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  Truncated. see log file for complete stacktrace
>

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.