icefaces 4.0 + wildfly 8.2 final + Maven范围提供不起作用

时间:2015-01-01 01:54:29

标签: java icefaces wildfly wildfly-8

我试图使用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>

welcomIceFaces

<?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次

警告:此页面调用以前缀ace声明的XML名称空间http://www.icefaces.org/icefaces/components,但该名称空间不存在taglibrary。

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)    

ant这是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一起工作。有一些身体工作,请分享。

2 个答案:

答案 0 :(得分:3)

在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>

答案 1 :(得分:0)

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

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