【问题标题】:JBoss 7.1, JSF, RichFaces - rich components don't want to renderJBoss 7.1、JSF、RichFaces - 丰富的组件不想渲染
【发布时间】:2012-04-25 07:17:21
【问题描述】:

我现在正在为我的 JSF 项目学习 RichFaces,但是在我的环境中渲染丰富的组件时遇到了问题。

我已使用 module.xml 将 RichFaces jar(来自 RichFaces 页面的所有 4 个 jar)添加到 JBoss 模块(E:\JBoss\modules\org\richfaces\main):

<module xmlns="urn:jboss:module:1.1" name="org.richfaces">
<resources>
<resource-root path="richfaces-components-api-4.2.1.Final.jar"/>
<resource-root path="richfaces-components-ui-4.2.1.Final.jar"/>
<resource-root path="richfaces-core-api-4.2.1.Final.jar"/>
<resource-root path="richfaces-core-impl-4.2.1.Final.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="org.w3c.css.sac"/>
<module name="net.sourceforge.cssparser"/>
<module name="com.sun.jsf-impl"/>
<module name="javax.api"/>
<module name="javax.faces.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.xml.jaxp-provider"/>
<module name="com.google.guava"/>
</dependencies>
</module>

默认配置下,所有依赖项都添加到 jboss 模块中。

我使用教程中的 RichFaces 创建了简单的 JSF 页面:

<!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:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j">

<h:head></h:head>
<body>
    <rich:panel>
        <f:facet name="header">
        Write your own custom rich components with built-in AJAX support
        </f:facet>
        <h:outputText value="Panel Body" />
    </rich:panel>
    <rich:panel>
        <f:facet name="header">
        Write your own custom rich components with built-in AJAX support
        </f:facet>
        <h:outputText value="Panel Body" />
        <a4j:form>
            <h:outputText value="The integer version of the selected color:" />
            <h:outputText id="RGBvalue" value="#{colorPickerBean.color}" />
            <rich:panel header="RichFaces Color Picker" style="width: 315px">
                <rich:colorPicker value="#{colorPickerBean.color}" colorMode="rgb"
                    converter="org.richfaces.IntegerColor">
                    <a4j:support event="onchange" reRender="RGBvalue" />
                </rich:colorPicker>
            </rich:panel>
        </a4j:form>
    </rich:panel>

</body>
</html>

head 标记中的两个 xmlns 都以“NLS 缺失消息:CANNOT_FIND_FACELET_TAGLIB in:org.eclipse.jst.jsf.core.validation.internal.facelet.messages”突出显示

我已经为 JBoss 部署了新的 xhtml 页面,但现在无法正确处理丰富的组件。下一个清单显示了已部署页面的来源。

<!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:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"><head></head>
<body>
    <rich:panel>Panel Body
    </rich:panel>
    <rich:panel>Panel Body
        <a4j:form>The integer version of the selected color:<span id="RGBvalue"></span>
            <rich:panel header="RichFaces Color Picker" style="width: 315px">
                <rich:colorPicker colorMode="rgb" converter="org.richfaces.IntegerColor">
                    <a4j:support event="onchange" reRender="RGBvalue"></a4j:support>
                </rich:colorPicker>
            </rich:panel>
        </a4j:form>
    </rich:panel>

</body>
</html>

我在 WebContent/META-INF 中的 jboss-deployment-structure.xml:

<jboss-deployment-structure>
    <sub-deployment name="Tutorial2.war">
        <dependencies>
            <module name="org.richfaces" slot="main">
                <imports>
                    <include path="**" />
                </imports>
            </module>
        </dependencies>
    </sub-deployment>
</jboss-deployment-structure>

模块定义如链接https://issues.jboss.org/browse/RF-12008中所示

经过几次修改后,我得到了

00:29:52,455 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."Tutorial2.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Tutorial2.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "Tutorial2.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_31]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_31]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_31]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Sub deployment Tutorial2.war in jboss-structure.xml was not found. Available sub deployments: 
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:233) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:159) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more

我将 jboss-deployment-structure.xml 添加到 WEB-INF 后立即发生错误。

【问题讨论】:

  • 您的jboss-deployment-structure.xml 在Tutorial2.war 中吗?如果是,那么它可能不应该是&lt;sub-deployment/&gt;。看看文档。 docs.jboss.org/author/display/AS71/…
  • 我试过没有子部署部分和标签丰富的标签不想呈现。

标签: jsf jboss richfaces


【解决方案1】:

这看起来可能是 eclipse 的问题。似乎 eclipse 和 JSF 有几个不同的问题。他们中的大多数人似乎在说什么this 一个人。

【讨论】:

  • 谢谢,Eclipse 警告问题已解决,但页面仍然不想正确呈现。
  • 我在部署前附加了源文件,部署后查看源文件。所有标签都正确渲染,只有rich和a4j没有渲染。
  • 您是否在部署中添加 org.richfaces 依赖项?也许在您的 MANIFEST.MF 中或使用 jboss-deployment-structure.xml。
  • 我重新检查了 jboss-deployment-structure.xml 并将其附加到问题中。
  • 您的插槽错误。应该是 &lt;module name="org.richfaces" slot="main"&gt; 或者只是关闭 slot 属性,main 是默认值。
【解决方案2】:

请参阅 jboss 论坛上的以下讨论 https://community.jboss.org/message/633025#633025 并寻找正确答案

您应该提供 jboss7 特定的部署描述符 jboss_deployment_structure.xml 以使您的应用程序可以使用richfaces 模块

【讨论】:

  • 我重新检查了 jboss-deployment-structure.xml 并将其附加到问题中。
猜你喜欢
  • 2011-10-14
  • 1970-01-01
  • 1970-01-01
  • 2012-05-31
  • 1970-01-01
  • 1970-01-01
  • 2011-06-11
  • 2016-10-08
  • 2011-12-23
相关资源
最近更新 更多