如何安装 PrettyFaces for Jakarta Faces 4.x

问题描述 投票:0回答:1

我在 Jakarta Server Faces 应用程序中使用漂亮的面孔。我的 POM 具有以下依赖项:

    <dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-servlet</artifactId>
        <version>8.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-config-prettyfaces</artifactId>
        <version>8.0.2.Final</version>
    </dependency>
    <dependency>
       <groupId>com.ocpsoft</groupId>
       <artifactId>prettyfaces-jsf2</artifactId>
       <version>3.3.3</version>
    </dependency>

首先我尝试了两个重写依赖项,然后尝试了最后一个漂亮脸依赖项,但没有一个起作用。这三个也都不起作用。 在 Wildfly 30 上部署总是失败,并出现以下错误:

22:01:42,194 WARN  [org.jboss.modules.define] (MSC service thread 1-8) Failed to define class com.ocpsoft.pretty.faces.application.PrettyViewHandler in Module "deployment.camplus.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/ocpsoft/pretty/faces/application/PrettyViewHandler

不仅仅是这一个错误。它也随之出现以下错误

22:01:42,121 WARN  [org.jboss.modules.define] (MSC service thread 1-8) Failed to define class com.ocpsoft.pretty.faces.application.PrettyNavigationHandler in Module "deployment.camplus.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/ocpsoft/pretty/faces/application/PrettyNavigationHandler

22:01:42,111 WARN  [org.jboss.modules.define] (MSC service thread 1-8) Failed to define class org.ocpsoft.rewrite.faces.RewriteViewHandler in Module "deployment.camplus.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/ocpsoft/rewrite/faces/RewriteViewHandler 

我还尝试在 web.xml 中添加以下内容

<filter>
        <filter-name>Pretty Filter</filter-name>
        <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>Pretty Filter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

我的 Pretty-config.xml 文件是:

<pretty-config
    xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
                      http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">

    <url-mapping id="login">
        <pattern value="/login" />
        <view-id value="/Login.jsf" />
    </url-mapping>
</pretty-config>

尝试了网站上写的所有内容,但漂亮的面孔不起作用,并且在 Wildfly30 上部署也失败。

Jakarta 版本为 10,Java 版本为 21

jsf prettyfaces jakarta-migration
1个回答
0
投票

我仅使用以下两个依赖项即可解决问题

<dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-servlet</artifactId>
        <version>8.0.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-config-prettyfaces</artifactId>
        <version>8.0.2.Final</version>
    </dependency>

另外提到的过滤器不应该出现在 web.xml 中

© www.soinside.com 2019 - 2024. All rights reserved.