I have 5 EARs that need to be deployed. One of them, local-configuration-ear-0.3.5-SNAPSHOT.ear
, is a dependency of all the others, and they require it at deployment time, i.e. local-configuration-ear-0.3.5-SNAPSHOT.ear
needs to be deployed first. All 5 of the EARs are located in the deployments
folder.
I read here that I can use jboss-deployment-structure.xml
to manage the order of EAR deployment, but I ran into some issues.
The file I made looks like this:
<?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>
but after deploying the EAR with this descriptor, I received the following error:
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
What am I doing wrong and is there a way to generate jboss-deployment-structure.xml
using Maven so that I can append a version number to my EAR file name programatically?
EDIT:
I also tried adding a jboss-all.xml
file to META-INF
, but it didn't help:
<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>
-with <filtering>true</filtering>
in the maven-ear-plugin
configuration. I checked inside the EAR archive, and the project version is set correctly, but the artefacts are still sometimes deployed in the incorrect order.
That link describes how to do deployment order inside EAR not between two ears.
You should be configuring jboss-all.xml with deployment dependencies.
content should look something like this:
<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>
and add this to all your ears but make sure you don't do cyclic deps.
来源:https://stackoverflow.com/questions/19959140/jboss-ear-deployment-order