java - Primefaces 应用程序无法运行

标签 java maven jsf primefaces jsf-2

您好,我正在使用 primefaces 5.3 版本、jsf 2.2 和 java 1.8,我有一个带有 primefaces 数据表延迟加载的页面,但它可以在本地计算机中工作,但在我部署到远程计算机中时最终会出现错误。我的中有任何错误吗?配置。

POM.XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>almightyenterprises</groupId>
    <artifactId>almightyenterprises</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.7.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>4.3.8.Final</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.34</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.14</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.14</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.4</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.2.9</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.3</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>all-themes</artifactId>
            <version>1.0.8</version>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.5</version>
        </dependency>
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.51</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <version>1.17</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-servlet</artifactId>
            <version>1.17</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-multipart</artifactId>
            <version>1.17</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.ez-vcard</groupId>
            <artifactId>ez-vcard</artifactId>
            <version>0.10.1</version>
        </dependency>
    </dependencies>
</project>

Index.xhtml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:hx="http://xmlns.jcp.org/jsf/passthrough"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:p="http://primefaces.org/ui">
<h:head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type" />
    <title>SMS Dasboard</title>
    <link rel="shortcut icon" href="../assets/images/favicon.ico" />
    <!-- Bootstrap core CSS     -->
    <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />

    <!-- Animation library for notifications   -->
    <link href="../assets/css/animate.min.css" rel="stylesheet" />
    <link href="../assets/css/style.css" rel="stylesheet" />
</h:head>

<h:body>
    <div id="wrapper">

        <!-- Top -->
        <div class="container">
            <div class="row">
                <div class="top">
                    <div class="col-lg-6">
                        <a href="index.xhtml"><img src="../assets/images/logo.png"
                            class="brand" alt="" /></a>
                    </div>
                    <div class="col-lg-6 pull-right">
                        <div class="links">
                            <ul>
                                <li><a href="#"><img
                                        src="../assets/images/settings.png" alt="" /> Settings</a></li>
                                <li><p:inputText name="" type="button"
                                        value="SMS Balance : 89,000"
                                        styleClass="btn balancebtn btn-default" /></li>
                                <li><a href="#"><img src="../assets/images/logout.png"
                                        alt=""></img> Logout</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Top End -->

        <!--   Main End  -->

        <section class="mainsec">
        <div class="container">
            <div class="row">

                <!--  Sidebar  -->
                <div class="col-lg-2">
                    <div class="sidebar">
                        <div class="headings pink">
                            <h3>latest activities</h3>
                        </div>
                        <div class="contentsec">
                            <p>Added 200 new items for 2 groups, Added 200 new items for
                                2 groups, Added 200 new items for 2 groups</p>
                            <div class="date">
                                <img src="../assets/images/date.png" alt="" /> 19.01.2017
                            </div>
                            <div class="time">
                                <img src="../assets/images/time.png" alt="" /> 11.12
                            </div>
                            <div class="border"></div>
                        </div>

                        <div class="contentsec" style="opacity: 0.3;">
                            <p>Added 200 new items for 2 groups, Added 200 new items for
                                2 groups, Added 200 new items for 2 groups</p>
                            <div class="date">
                                <img src="../assets/images/date.png" alt="" /> 18.01.2017
                            </div>
                            <div class="time">
                                <img src="../assets/images/time.png" alt="" /> 12.12
                            </div>
                            <div class="border"></div>
                        </div>

                        <div class="contentsec" style="opacity: 0.3;">
                            <p>Added 200 new items for 2 groups, Added 200 new items for
                                2 groups, Added 200 new items for 2 groups</p>
                            <div class="date">
                                <img src="../assets/images/date.png" alt="" /> 17.01.2017
                            </div>
                            <div class="time">
                                <img src="../assets/images/time.png" alt="" /> 09.12
                            </div>
                            <div class="border"></div>
                        </div>

                    </div>
                </div>

                <!--  Sidebar End -->

                <!--  CenterSec  -->

                <div class="col-lg-7">
                    <div class="centersec">
                        <div class="collapse" id="collapseExample">
                            <div class="card-block">
                                <h3>Add Items</h3>
                                <p>
                                    <h:form styleClass="form-group" id="uppperForm">
                                        <label>Name</label>
                                        <p:inputText styleClass="col-lg-12 input-group" />
                                        <label>Email</label>
                                        <input class="col-lg-12 input-group" />
                                        <label>Phone No</label>
                                        <p:inputText styleClass="col-lg-12 input-group" />
                                        <label>Group</label>
                                        <div class="clearfix"></div>
                                        <p:inputText styleClass="col-lg-9 input-group input1" />
                                        <p:inputText name="" type="button" value="+ Add"
                                            styleClass="col-lg-2 btn1" />
                                        <p:inputText name="" type="button" value="Add Contact"
                                            styleClass="btn editbtn btn-default" />
                                    </h:form>
                                </p>
                            </div>
                        </div>


                        <div class="additems">
                            <div class="headings yellow">
                                <h3>
                                    <a data-toggle="collapse" href="#collapseExample"
                                        aria-expanded="false" aria-controls="collapseExample">Add
                                        Items</a>
                                </h3>
                                <span>1612</span>
                            </div>
                            <div class="filter">
                                <img src="../assets/images/items.png" alt="" />
                            </div>
                            <div class="listing">
                                <h:form id="itemsListingForm">
                                    <p:dataTable rows="20" lazy="true"
                                        paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                        rowKey="#{item.itemCode}" id="itemDetailTable"
                                        widgetVar="itemDetailTablewVar" scrollRows="20"
                                        liveScroll="true" scrollHeight="430" scrollable="true"
                                        value="#{productBean.jobLazyDataItemList}" var="item"
                                        filteredValue="#{productBean.itemModelList}"
                                        selectionMode="multiple" editable="true" editMode="cell"
                                        selection="#{productBean.selectedItemList}">
                                        <f:facet name="header">
                                            <p:outputPanel>
                                                <p:inputText id="globalFilter" styleClass="col-lg-12 search"
                                                    onkeyup="PF('itemDetailTablewVar').filter()"
                                                    placeholder="Search" />

                                            </p:outputPanel>
                                        </f:facet>
                                        <p:ajax event="cellEdit"
                                            listener="#{productController.onCellEditTableComplete(item)}"
                                            update="@([id$=itemDetailTable])" />
                                        <p:column headerText="Item Code" filterBy="#{item.itemCode}"
                                            styleClass="col-lg-2" filterStyle="display:none;">
                                            <h:outputText value="#{item.itemCode}"
                                                style="font-weight: bold" />
                                        </p:column>
                                        <p:column headerText="Item Name" filterBy="#{item.itemName}"
                                            styleClass="col-lg-8" filterStyle="display:none;">
                                            <h:outputText value="#{item.itemName}" />
                                        </p:column>
                                        <p:column headerText="Item Price" filterBy="#{item.itemPrice}"
                                            styleClass="col-lg-2" filterStyle="display:none;">
                                            <p:cellEditor>
                                                <f:facet name="output">
                                                    <h:outputText value="#{item.itemPrice}" />
                                                </f:facet>
                                                <f:facet name="input">
                                                    <p:inputText value="#{item.itemPrice}" style="width:96%" />
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>
                                    </p:dataTable>

                                </h:form>
                            </div>
                        </div>

                        <div class="addgroup">
                            <div class="headings green">
                                <h3>Add Contact</h3>
                                <span>798</span>
                            </div>

                            <h:form id="contactListForm">
                                <div class="filter">
                                    <img src="../assets/images/groups.png" alt="" />
                                    <p:selectOneMenu value="#{productBean.selectedGroup}"
                                        styleClass="select pull-right">
                                        <f:selectItem itemLabel="Select" itemValue=""
                                            noSelectionOption="true"></f:selectItem>
                                        <f:selectItems value="#{productBean.contactGroups}"
                                            var="group" itemLabel="#{group.groupName}"
                                            itemValue="#{group.groupName}"></f:selectItems>
                                        <p:ajax listener="#{productController.filterContact}"
                                            event="change" update="contactListForm" />
                                    </p:selectOneMenu>
                                </div>
                                <div class="listing">
                                    <p:dataTable rows="20" lazy="true"
                                        paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                        rowKey="#{contact.contactId}" id="contactDetailTable"
                                        widgetVar="contactDetailTablewVar" scrollRows="20"
                                        liveScroll="true" scrollHeight="430" scrollable="true"
                                        value="#{productBean.jobLazyDataContactList}" var="contact"
                                        filteredValue="#{productBean.contactModelList}"
                                        selectionMode="multiple" editable="true" editMode="cell"
                                        selection="#{productBean.selectedContactList}">
                                        <f:facet name="header">
                                            <p:outputPanel>
                                                <p:inputText id="globalFilter" styleClass="col-lg-12 search"
                                                    onkeyup="PF('contactDetailTablewVar').filter()"
                                                    placeholder="Search" />
                                            </p:outputPanel>
                                        </f:facet>
                                        <p:column headerText="Contact Name"
                                            filterBy="#{contact.contactFirstName}"
                                            filterStyle="display:none;">
                                            <h:outputText value="#{contact.contactFirstName}" />
                                            <h:outputText value="#{contact.contactSecondName}" />
                                        </p:column>
                                        <p:column headerText="Contact Number"
                                            filterBy="#{contact.contactMobile}"
                                            filterStyle="display:none;">
                                            <h:outputText value="#{contact.contactMobile}" />
                                        </p:column>
                                    </p:dataTable>
                                </div>
                            </h:form>
                        </div>
                    </div>
                </div>

                <!--  CenterSec End -->

                <!--  RighrSec  -->

                <div class="col-lg-3">
                    <div class="rightsec">
                        <textarea name="Type Your Message Here..." cols="" rows="8"
                            class="col-lg-12" placeholder="Type Your Message Here..."></textarea>
                        <p>maximum characters : 200</p>
                        <textarea name="Type Your Message Here..." cols="" rows="14"
                            class="col-lg-12" placeholder="Preview..."></textarea>
                        <input name="" type="button" value="Update"
                            class="btn updatebtn btn-default pull-right" />
                    </div>
                </div>

                <!--  RighrSec End  -->

            </div>
        </div>
        </section>

        <!--   Main End  -->

        <!--   Footer   -->

        <footer>
        <div class="col-lg-12">
            <p>&copy; Company Name. 2017</p>
        </div>

        </footer>
        <!--   Footer End  -->
    </div>


    <!--   Core JS Files   -->
    <!-- <script src="../assets/js/jquery-1.10.2.js" type="text/javascript"></script>
    <script src="../assets/js/bootstrap.min.js" type="text/javascript"></script> -->
</h:body>
</html>

日志

com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError java.lang.NoSuchMethodError: org.primefaces.util.ResourceUtils.getComponentResources(Ljavax/faces/context/FacesContext;)Ljava/util/ArrayList;
    at org.primefaces.application.resource.DynamicResourcesPhaseListener.afterPhase(DynamicResourcesPhaseListener.java:31)
    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Unknown Source)
    at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(Unknown Source)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(Unknown Source)
    at javax.faces.webapp.FacesServlet.service(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    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)

最佳答案

在我看来,primeface 与 javax.faces 之间的版本不匹配。可以升级到 primeface 6 吗?您的 5.3 不知道 ResourceUtils#getComponentResources。这有点难看,因为 primeface 在他们的 javadoc 中的 @since-Annotation 上拉屎;)

关于java - Primefaces 应用程序无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42020357/

相关文章:

java - OneToOne 的mappedBy 行为很奇怪

java - 是否可以获取打包项目时使用的maven命令?

java - 如何在第二个 JSF 项目中运行一个 JSF WAR 文件?

java - 对Java原始数据类型(Byte和Int)的疑问

java - 使用 Map 发送内嵌图像 javaMail Google App Engine

java - 如何强制 IntelliJ 中的 Maven 从本地 .m2 存储库中提取特定依赖项

java - 链接的奇怪行为 - 页面上显示的每个链接都附加了 URL

html - 如何使 div 匹配包含 td 的高度?

java - 如何隐藏/删除/避免系统应用程序(非 UI)在 Android 应用程序抽屉中列出/显示?

java - Tomcat 图标有问题