JBoss EAR部署顺序

时间:2013-11-13 16:27:48

标签: maven jboss jboss7.x maven-3 maven-ear-plugin

我有5个需要部署的EAR。其中之一local-configuration-ear-0.3.5-SNAPSHOT.ear是所有其他人的依赖关系,他们在部署时需要它,即需要首先部署local-configuration-ear-0.3.5-SNAPSHOT.ear。所有5个EAR都位于deployments文件夹中。

我阅读here我可以使用jboss-deployment-structure.xml来管理EAR部署的顺序,但我遇到了一些问题。 我制作的文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
   <deployment>
       <dependencies>
           <module name="deployment.local-configuration-ear-0.3.5-SNAPSHOT.ear" />
       </dependencies>
   </deployment>
</jboss-deployment-structure>

但在使用此描述符部署EAR后,我收到以下错误:

15:01:29,752 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.module.service."deployment.asterix-connector-ear-0.3.5-SNAPSHOT.ear".main: org.jboss.msc.service.StartException in s ervice jboss.module.service."deployment.asterix-connector-ear-0.3.5-SNAPSHOT.ear".main: Failed to load module: deployment.asterix-connector-ear-0.3.5-SNAPSHOT.ear:main
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [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.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_24]
    at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
Caused by: org.jboss.modules.ModuleNotFoundException: deployment.local-configuration-ear-0.3.5-SNAPSHOT:main
    at org.jboss.modules.Module.addPaths(Module.java:854)
    at org.jboss.modules.Module.link(Module.java:1181)
    at org.jboss.modules.Module.relink(Module.java:1211)
    at org.jboss.modules.ModuleLoader.relink(ModuleLoader.java:445)
    at org.jboss.as.server.moduleservice.ServiceModuleLoader.relinkModule(ServiceModuleLoader.java:204) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:71) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more

我做错了什么,是否有办法使用Maven生成jboss-deployment-structure.xml,以便我可以以编程方式将版本号附加到我的EAR文件名?

修改

我还尝试将jboss-all.xml文件添加到META-INF,但它没有帮助:

<jboss umlns="urn:jboss:1.0">
    <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="local-configuration-ear-${project.version}.ear" />
    </jboss-deployment-dependencies>
</jboss>

- <filtering>true</filtering>配置maven-ear-plugin。我检查了EAR存档内部,并且项目版本设置正确,但是人工制品有时仍然以错误的顺序部署。

1 个答案:

答案 0 :(得分:1)

该链接描述了如何在EAR内部进行部署顺序而不是在两只耳朵之间。

您应该使用部署依赖项配置jboss-all.xml。

内容应如下所示:

<jboss umlns="urn:jboss:1.0">
    <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="app1.ear" />
        <dependency name="app2.ear" />
        <dependency name="app3.ear" />
    </jboss-deployment-dependencies>
</jboss>

并将此添加到您的所有耳朵,但请确保您不做循环代码。