3

Right now im using the following:

  • NetBeans 8.2
  • Apache Tomcat 8.0.53
  • JSF 2.2
  • IceFaces 4.3
  • All in a Maven project (3.6 I think)

Im trying to fill an "ace:dataTable" with a List that I've already created.

When I try to run the "Principal.xhtml" whitout the ace:dataTable The page loads normally, BUT If I add the ace:dataTable with the values that I want to fill it shows me the error "HTTP 500 – Internal Server Error" with the exception "javax.servlet.ServletException: javax/enterprise/context/spi/Contextual javax.faces.webapp.FacesServlet.service(FacesServlet.java:683) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)"

Here is the dependencys that Im using in the pom.xml

   <dependency>
            <groupId>org.icefaces</groupId>
            <artifactId>icefaces</artifactId>
            <version>4.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.icefaces</groupId>
            <artifactId>icefaces-ace</artifactId>
            <version>4.3.0</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

Also here is the code that Im using in the XHTML


<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components">

    <h:head>
        <title>List Test</title>
    </h:head>
    <h:body>
        <ace:dataTable id="test"
                       value="#{personaController.listaPersona}"
                       rows="5"
                       var="item" 
                       paginator="true" styleClass="textTabla" paginatorPosition="bottom">

            <ace:column>
                <f:facet name="header">
                    <h:outputText value="SOLICITUD" styleClass="textTablaCabeza" />
                </f:facet>
                <h:outputText value="#{item.nombre}"  styleClass="textTablaDetalle" />
            </ace:column>
        </ace:dataTable>
    </h:body> 
</html>

And this is the controller

import lista.model.PersonaModel;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import lista.beans.PersonaBean;

@ManagedBean()
@ViewScoped
public class PersonaController {

    private List<PersonaBean> listaPersonaBean;
    private PersonaModel model;

    public PersonaController() {
        consultarLista();
    }

    public void consultarLista() {
        this.listaPersonaBean = this.model.retornaLista();
    }

    public List<PersonaBean> getListaPersona() {
        return listaPersonaBean;
    }

}

There is a model in between the controller to set the list, but thats not the main issue.

Idk what to do

Here is the full error

excepción

javax.servlet.ServletException: javax/enterprise/context/spi/Contextual
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:683)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

causa raíz

java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:348)
    com.sun.faces.util.Util.loadClass(Util.java:333)
    com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1847)
    com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:2019)
    com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1246)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:588)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:176)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:135)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96)
    javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:161)
    com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203)
    javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:135)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96)
    com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:94)
    javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96)
    com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:88)
    com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:162)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:381)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Janel Garces
  • 33
  • 1
  • 1
  • 3

3 Answers3

9

It looks like your missing a required dependency in your pom for cdi-api:

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <version>1.2</version>
</dependency>
camtastic
  • 955
  • 6
  • 15
0

At the end, I needed to add the cdi-api dependency and I had to add the .jar manually to the "WEB-INF/lib/" folder

Janel Garces
  • 33
  • 1
  • 1
  • 3
0
try with the following dependencies

<!-- CDI required APIs -->
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jcdi_2.0_spec</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-interceptor_1.2_spec</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-annotation_1.3_spec</artifactId>
            <version>1.0</version>
        </dependency>

        <!-- CDI Impl -->
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-impl</artifactId>
            <version>${owb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-web</artifactId>
            <version>${owb.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-jsf</artifactId>
            <version>${owb.version}</version>
        </dependency>
Giovanni Perea
  • 328
  • 3
  • 5