使用jboss cli进行域模式部署无法选择模块

时间:2018-04-13 20:40:05

标签: deployment jboss ear wildfly-10 jboss-eap-7

我在域模式下使用JBoss EAP 7.1。

我在eap_home/modules文件夹中设置了我的静态模块:

com
|- organization
  |- global
    |- main (this has module.xml)

我想要部署myservice.ear

独立模式:

ear 放在standalone/deployment/内,然后使用./standalone.sh启动服务器:正常工作。

域名模式:

使用jboss-cli进行部署:失败

deploy /<PATH>/myservice.ear --name=myservice --runtime-name=myservice.ear --server-groups=main-server-group

我收到以下错误消息:

[.... /] deploy /<PATH>/myservice.ear --name=myservice --runtime-name=myservice.ear --server-groups=main-server-group
{"WFLYDC0074: Operation failed or was rolled back on all servers. Server failures:" => {"server-group" => {"main-server-group" => {"host" => {"slave1" => {"server-one" => {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"WFLYCTL0080: Failed services" => {"jboss.module.service.\"deployment.services.ear.service-one-SNAPSHOT.war\".main" => "WFLYSRV0179: Failed to load module: deployment.services.ear.service-one-SNAPSHOT.war
    Caused by: org.jboss.modules.ModuleNotFoundException: com.organization.global",.......<few more statements with the same exception> ....

任何想法可能是什么原因?

注意:我稍微修改了文件名和消息,以隐藏组织的具体细节。如果您需要任何澄清,请告诉我。

额外信息:

EAR/META-INF/jboss-deployment-structure.xml文件:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <deployment>
     <dependencies>
         <module name="com.organization.global" export="true"/>
     </dependencies>
  </deployment>
</jboss-deployment-structure>

我在EAR中有几个WAR文件,每个WAR文件都包含自己的WAR/WEB-INF/jboss-deployment-structure.xml版本并包含以下内容:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
  <deployment>
     <dependencies>
        <module name="com.organization.global"/>
     </dependencies>
  </deployment>
</jboss-deployment-structure>

EAR的xml在META-INF内,但对于WAR,它位于WEB-INF下。

2 个答案:

答案 0 :(得分:1)

只会读取您EAR中的jboss-deployment-structure.xml。如果子部署需要额外的模块依赖性,则需要将该配置添加到EAR的描述符中。

您应该从WAR中删除jboss-deployment-structure.xml并将EAR中的那个更改为如下所示。

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <deployment>
     <dependencies>
         <module name="com.organization.global" export="true"/>
     </dependencies>
  </deployment>
  <sub-deployment name="service-one-SNAPSHOT.war">
     <dependencies>
         <module name="com.organization.global" export="true"/>
     </dependencies>
  </sub-deployment>
</jboss-deployment-structure>

至于为什么它似乎部署到独立服务器,那不应该工作。部署处理完全相同。如果它正常工作,我说它可能是某个地方的错误。

答案 1 :(得分:0)

我在com/organization/global下设置了静态模块EAP_MASTER_HOME/modules/。 在独立模式下部署尝试仅将其部署到在master上运行的服务器,以便部署正常工作。 当我尝试在域模式下部署EAR时,在slave-eap上运行的服务器正在寻找EAP_SLAVE_HOME/modules/下的模块。

EAP_SLAVE_HOME/modules/下添加静态模块(或符号链接)解决了这个问题。