【问题标题】:How to run jsf mojarra 2.3 in wildfly 13 with netbeans 8.2?如何使用 netbeans 8.2 在 Wildfly 13 中运行 jsf mojarra 2.3?
【发布时间】:2019-01-14 18:08:10
【问题描述】:

我在 netbeans 中创建了一个项目并添加了 jboss_jsf-api_2.3,然后创建了我的 faces_config.xml。但我有一个错误:

由于一个或多个间接依赖项不可用,一个或多个服务无法启动

面孔配置是:

<faces-config
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
    version="2.3">
</faces-config>

我的 pom 是:

<dependencies>
   
        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.3_spec</artifactId>
            <version>2.3.5.SP1</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>6.2</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
 
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>

【问题讨论】:

  • 为什么没有设置jsf api为provided?
  • 是的,我现在放了 provided,但现在我写“FacesContext.class.getPackage().getImplementationVersion()”,结果是“2.2.13.SP2”我现在不知道如何更改为 jsf 2.3
  • 所以你在wildfly.org/news/2018/05/30/WildFly13-Final-Released阅读了所有内容

标签: jsf jboss wildfly


【解决方案1】:

虽然 Wildfly 13 包含 大多数 JavaEE 8 功能,但它默认以 JavaEE 7 模式启动,即“只是”JSF 2.2。

来自最近的WildFly 13 release documentation

默认情况下,WildFly 13 以 EE7 模式启动。为了使用这些新功能,您必须启用 EE8 预览模式。这可以通过在启动期间传递 ee8.preview.mode 属性来完成:

./standalone.sh -Dee8.preview.mode=true

还有其他选项可以启用此功能。来自相同的文档:

或者,这可以通过使用新的standalone-ee8.xml 配置启动服务器来实现,该配置只是将属性包含在配置中。

./standalone.sh -c standalone-ee8.xml

CLI 也可用于修改现有配置以添加此属性。例如:

embed-server --admin-only=true /system-property=ee8.preview.mode:add(value=true) stop-embedded-server

你应该拥有 JSF 2.3

【讨论】:

猜你喜欢
  • 2017-12-18
  • 2019-04-09
  • 2016-04-20
  • 1970-01-01
  • 2015-08-28
相关资源
最近更新 更多