【问题标题】:icefaces 4.0 + wildfly 8.2 final + Maven scope provided not workingicefaces 4.0 + wildfly 8.2 final + Maven 范围提供不工作
【发布时间】:2015-01-01 01:54:29
【问题描述】:

我正在尝试使用 icefaces 4.0 和最新版本的 wildfly。但在这里不起作用的是我的代码:

我正在使用 jdk 8

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>com.mycompany</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>mavenproject1</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces</artifactId>
        <version>4.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces-ace</artifactId>
        <version>4.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <archive>
                    <manifestEntries>
                        <Dependencies>org.icefaces, org.icefaces.ace</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>7.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

欢迎冰面

<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
  xmlns:ace="http://www.icefaces.org/icefaces/components">
<h:head>
    <title>ICEfaces Welcome Page</title>
    <!-- This line is only for ICE component, remove it if no ice component is used in this page.-->
    <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
</h:head>
<h:body>
    <h:form>

        <ace:panel header="Welcome to ICEfaces">
            <h:panelGrid columns="1">
                <!-- NOTICE -To run this page you must have also ICEfaces ACE components library on your classpath (project dependencies). -->
                <ace:linkButton id="linkButton1" value="ICEfaces Overview" href="http://wiki.icesoft.org/display/ICE/ICEfaces+Overview"></ace:linkButton>
                <ace:linkButton id="linkButton2" value="General Documentation" href="http://wiki.icesoft.org/display/ICE/ICEfaces+Documentation"></ace:linkButton>
                <ace:linkButton id="linkButton3" value="ICEfaces Demos" href="http://www.icesoft.org/demos/icefaces-demos.jsf"></ace:linkButton>
                <ace:linkButton id="linkButton4" value="Tutorials" href="http://www.icesoft.org/community/tutorials-samples.jsf"></ace:linkButton>
                <ace:linkButton id="linkButton5" value="ACE components" href="http://wiki.icesoft.org/display/ICE/ACE+Components"></ace:linkButton>
                <ace:linkButton id="linkButton6" value="ICE components" href="http://wiki.icesoft.org/display/ICE/ICE+Components"></ace:linkButton>
                <!-- You can also use ICE components. Adds ICE namespace in that case: xmlns:ice="http://www.icesoft.com/icefaces/component" -->
                <!-- <ice:outputLink id="aceLink" value="http://wiki.icesoft.org/display/ICE/ACE+Components" target="_blank">ACE components</ice:outputLink> -->
                <!-- <ice:outputLink id="iceLink" value="http://wiki.icesoft.org/display/ICE/ICE+Components" target="_blank">ICE components</ice:outputLink> -->
            </h:panelGrid>
        </ace:panel>

    </h:form>
</h:body>

我在浏览器中遇到此错误 x 在同一页面中出现了 6 次

警告:此页面调用 XML 命名空间 http://www.icefaces.org/icefaces/components 声明,前缀为 ace,但该命名空间不存在标记库。

ok 是一个警告,但它不会取代 ace 组件。

我已经在服务器中添加了模块和所有的module.xml文件

<module xmlns="urn:jboss:module:1.3" name="org.icefaces">
<resources>
    <resource-root path="icefaces-4.0.0.jar"/>
</resources>

<dependencies>
    <module name="javax.faces.api"/>        
<module name="org.w3c.dom"/>
</dependencies>

还有这个

<module xmlns="urn:jboss:module:1.3" name="org.icefaces.ace">
<resources>
    <resource-root path="icefaces-ace-4.0.0.jar"/>
</resources>

<dependencies>
    <module name="javax.faces.api"/>        
<module name="org.icefaces"/>
</dependencies>

服务器显示:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed   in 8.0
20:40:32,339 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
20:40:32,471 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
20:40:32,514 INFO  [org.jboss.as] (MSC service thread 1-5) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
20:40:33,112 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
20:40:33,126 INFO  [org.xnio] (MSC service thread 1-14) XNIO version 3.3.0.Final
20:40:33,133 INFO  [org.xnio.nio] (MSC service thread 1-14) XNIO NIO Implementation Version 3.3.0.Final
20:40:33,147 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
20:40:33,152 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
20:40:33,155 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
20:40:33,155 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
20:40:33,156 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
20:40:33,157 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
20:40:33,167 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
20:40:33,174 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.21.Final
20:40:33,182 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
20:40:33,193 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
20:40:33,194 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-13) JBAS017502: Undertow 1.1.0.Final starting
20:40:33,200 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-9) JBAS015400: Bound mail session [java:jboss/mail/Default]
20:40:33,201 INFO  [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
 20:40:33,206 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
20:40:33,209 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-15) JBAS010417: Started Driver service with driver-name = h2
20:40:33,218 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.3)
20:40:33,219 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = postgresql
20:40:33,273 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\software\wildfly-8.2.0.Final/welcome-content
20:40:33,358 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017525: Started server default-server.
20:40:33,370 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017531: Host default-host starting
20:40:33,372 INFO  [org.jboss.remoting] (MSC service thread 1-14) JBoss Remoting version 4.0.6.Final
20:40:33,386 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 3.0)
20:40:33,388 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-16) JBAS010417: Started Driver service with driver-name = sqlserver2008
20:40:33,395 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
20:40:33,396 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010417: Started Driver service with driver-name = mySQL
20:40:33,404 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-15) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
20:40:33,480 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) JBAS015012:    Started FileSystemDeploymentService for directory C:\software\wildfly-   8.2.0.Final\standalone\deployments
20:40:33,483 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
20:40:33,484 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/co.com.stratigeek.stork.datosDS]
20:40:33,485 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/co.com.dideweb.hyla.ventas.datos.datosDS]
20:40:33,486 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "mavenproject1-1.0-SNAPSHOT.war" (runtime-name: "mavenproject1-1.0-SNAPSHOT.war")
20:40:33,601 INFO  [org.jboss.ws.common.management] (MSC service thread 1-15) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
20:40:33,812 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Inicializando Mojarra 2.2.8-jbossorg-1 20140822-1131 para el contexto '/mavenproject1-1.0-SNAPSHOT'
20:40:34,103 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017534: Registered web context: /mavenproject1-1.0-SNAPSHOT
20:40:34,126 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "mavenproject1-1.0-SNAPSHOT.war" (runtime-name : "mavenproject1-1.0-SNAPSHOT.war")
20:40:34,399 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
20:40:34,400 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
20:40:34,400 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 2245ms - Started 266 of 321 services (92 services are lazy, passive or on-demand)    

这是faces-config文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 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-app_3_1.xsd">
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>

有什么想法吗??请帮忙。该应用程序只是让 maven 和 wilfly 的 ace 组件工作。有一些身体的例子,请分享。

【问题讨论】:

  • 那些服务器日志在任何地方都不会产生SEVERE 日志级别。 "警告:此页面调用 XML 命名空间 http://www.icefaces.org/icefaces/components 声明,前缀为 ace,但该命名空间不存在标记库。" 虽然 pom.xml 中有 Maven 依赖项,但您是否不小心忘记添加IceFaces 库到类路径?正如您所说,这不能掉以轻心,“ok 是一个警告,但它不会取代 ace 组件。

标签: java icefaces wildfly wildfly-8


【解决方案1】:

在 JBoss/Wildfly 中,标签库仅在它们出现在 WEB-INF/lib 内的 jar 中或在 WEB-INF 下的 tld 中定义时才会被扫描。

此行为已在 8.2 版中修改,请参阅 mechanism to load tag libraries from module

一个可行的解决方案是在应用程序中添加jboss-deployment-structure.xml,如下所示:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <module name="my.module.that.has.tlds" export="true" meta-inf="export"/>
  </deployment>
</jboss-deployment-structure>

另见:Class Loading in WildFly


更新:

要将 ICEfaces 用作 JBoss 模块,您需要:

首先创建一个模块(在我的测试中我只创建了一个模块):

<module xmlns="urn:jboss:module:1.3" name="org.icefaces">
    <resources>
        <resource-root path="icefaces.jar"/>
        <resource-root path="icefaces-ace.jar"/>
    </resources>

    <dependencies>
        <module name="javax.faces.api"/>        
        <module name="javax.api"/>
    </dependencies>
</module>

第二次在WEB-INF目录jboss-deployment-structure.xml文件中添加你的web项目和下一个内容:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name="org.icefaces" export="true" meta-inf="export"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

【讨论】:

  • 好的,那是正确的,但是您要添加什么库?我想我已经这样做了org.apache.maven.pluginsmaven-war-plugin2.3false org.icefaces, org.icefaces.ace
  • @nsanchezb 检查我的更新,我为您的问题添加了具体示例。
  • 所以我不需要在我的 pom.xml 中添加 icefaces?
  • @Johnny2012 是的,您可以添加,但需要提供范围
【解决方案2】:

尝试将meta-inf 参数添加到您的Dependencies:manifest 标头中,有关详细信息,请参阅Class Loading in WildFly

顺便说一句,我想说尝试将 ICEfaces 安装为一个模块意味着很难做到。将所需的库作为普通的 compileruntime 范围依赖项简单地包含在您的 WAR 中有什么问题?

【讨论】:

  • 使用 pom 中的编译方式我得到另一个错误,stackoverflow.com/questions/22726308/… 似乎 WildFly 已经附带了一个 JSF 实现,如果我在 icefaces 中部署一个应用程序,我会得到这个错误。命名空间 EEROR 中名为 inputFile 的标记:xmlns.jcp.org/jsf/html 定义了一个空处理程序类
猜你喜欢
  • 2011-05-31
  • 2015-10-04
  • 2011-03-24
  • 1970-01-01
  • 1970-01-01
  • 2015-06-05
  • 2018-05-19
  • 2014-07-13
  • 1970-01-01
相关资源
最近更新 更多