Home  >  Forum  >  JSF
Post New Query

java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual


joined on
January 20,2015
Asked on January 29,2015
Hi, I am learning JSF 2 and PrimeFaces 5. I am getting the error in my test Application as below.

java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
    at com.sun.faces.application.view.ViewScopeManager.<init>(Unknown Source)
    at com.sun.faces.application.view.ViewScopeManager.getInstance(Unknown Source)
    at com.sun.faces.application.view.ViewScopeEventListener.processEvent(Unknown Source)
    at javax.faces.event.SystemEvent.processListener(Unknown Source)
    at javax.faces.event.ComponentSystemEvent.processListener(Unknown Source)
    at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source)
    at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source)
    at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source)
    at javax.faces.component.UIViewRoot.getViewMap(Unknown Source)
    at javax.faces.component.UIViewRoot.getViewMap(Unknown Source)
    at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(Unknown Source)
    at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(Unknown Source)
    at com.sun.faces.mgbean.BeanManager.createAndPush(Unknown Source)
    at com.sun.faces.mgbean.BeanManager.create(Unknown Source)
    at com.sun.faces.el.ManagedBeanELResolver.resolveBean(Unknown Source)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(Unknown Source)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(Unknown Source)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(Unknown Source)
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:160)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(Unknown Source)
    at javax.faces.component.ComponentStateHelper.eval(Unknown Source)
    at javax.faces.component.ComponentStateHelper.eval(Unknown Source)
    at javax.faces.component.UIData.getValue(Unknown Source)
    at org.primefaces.component.api.UIData.getDataModel(UIData.java:629)
    at org.primefaces.component.api.UIData.setRowModel(UIData.java:436)
    at org.primefaces.component.api.UIData.setRowIndex(UIData.java:428)
    at org.primefaces.component.datascroller.DataScrollerRenderer.loadChunk(DataScrollerRenderer.java:132)
    at org.primefaces.component.datascroller.DataScrollerRenderer.encodeMarkup(DataScrollerRenderer.java:94)
    at org.primefaces.component.datascroller.DataScrollerRenderer.encodeEnd(DataScrollerRenderer.java:45)
    at javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.render.Renderer.encodeChildren(Unknown Source)
    at javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at javax.faces.component.UIComponent.encodeAll(Unknown Source)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
    at com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
    at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
    at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
    at javax.faces.webapp.FacesServlet.service(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    ... 64 more


joined on
August 11,2014
Replied on January 31,2015

You are missing cdi-api.

Use gradle as 
compile 'javax.enterprise:cdi-api:1.2'

or maven as 

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us