错误 java.lang.ClassNotFoundException: javax.

现在我使用以下内容:

  • NetBeans 8.2

  • 阿帕奇汤姆猫 8.0.53

  • JSF 2.2

  • 冰面 4.3

  • 全部在 Maven 项目中(我认为是 3.6)

我试图用我已经创建的列表填充“ace:dataTable”。

当我尝试在没有 ace:dataTable 的情况下运行“Principal.xhtml”时,页面加载正常,但是如果我添加带有我想要填充的值的 ace:dataTable,它会显示错误“HTTP 500 – 内部服务器错误”例外“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)"

这是我在 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>


这也是我在 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>


汪汪一只猫
浏览 123回答 3
3回答

呼唤远方

看起来您在 pom 中缺少 cdi-api 所需的依赖项:<dependency>&nbsp; &nbsp; <groupId>javax.enterprise</groupId>&nbsp; &nbsp; <artifactId>cdi-api</artifactId>&nbsp; &nbsp; <version>1.2</version></dependency>

米琪卡哇伊

try with the following dependencies<!-- CDI required APIs -->&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.geronimo.specs</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>geronimo-atinject_1.0_spec</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>1.0</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.geronimo.specs</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>geronimo-jcdi_2.0_spec</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>1.1</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.geronimo.specs</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>geronimo-interceptor_1.2_spec</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>1.0</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.geronimo.specs</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>geronimo-annotation_1.3_spec</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>1.0</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <!-- CDI Impl -->&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.openwebbeans</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>openwebbeans-impl</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>${owb.version}</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.openwebbeans</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>openwebbeans-web</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>${owb.version}</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.openwebbeans</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>openwebbeans-jsf</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>${owb.version}</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>

翻翻过去那场雪

最后,我需要添加 cdi-api 依赖项,并且必须手动将 .jar 添加到“WEB-INF/lib/”文件夹中
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java