根據Wildfly's documentation,應該可以聲明在EAR中部署子部署的順序。但是,我無法讓它尊重我在應用程序中定義的依賴關係的順序。我如何獲得Wildfly以正確的順序加載我的EAR部署?
EAR指定了initialize-in-order
並且我在JBoss特定文件中指定了一個依賴關係鏈webapp-three -> webapp-two -> webapp-one
。
我錯過了關於如何聲明這一點?
application.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>ear</display-name>
<initialize-in-order>true</initialize-in-order>
<module>
<web>
<web-uri>webapp-one-1.0-SNAPSHOT.war</web-uri>
<context-root>/one</context-root>
</web>
</module>
<module>
<web>
<web-uri>webapp-two-1.0-SNAPSHOT.war</web-uri>
<context-root>/two</context-root>
</web>
</module>
<module>
<web>
<web-uri>webapp-three-1.0-SNAPSHOT.war</web-uri>
<context-root>/three</context-root>
</web>
</module>
</application>
jboss-deployment-structure.xml
:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<sub-deployment name="webapp-one-1.0-SNAPSHOT.war">
</sub-deployment>
<sub-deployment name="webapp-two-1.0-SNAPSHOT.war">
<dependencies>
<module name="deployment.wildfly-deployment-order.ear.webapp-one-1.0-SNAPSHOT.war" />
</dependencies>
</sub-deployment>
<sub-deployment name="webapp-three-1.0-SNAPSHOT.war">
<dependencies>
<module name="deployment.wildfly-deployment-order.ear.webapp-two-1.0-SNAPSHOT.war" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
我希望部署順序爲:
webapp-one
webapp-two
webapp-three
這裏是Wildfly如何部署:
11:27:31,046 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-two-1.0-SNAPSHOT.war") 11:27:31,046 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-three-1.0-SNAPSHOT.war") 11:27:31,047 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-one-1.0-SNAPSHOT.war")
謝謝,斯圖爾特。因此,如果我的理解正確,「正在啓動子部署」消息不一定對應於正在啓動的部署中的組件。 –
有沒有辦法通過依賴來定義初始化的順序,而不是使用initialize-in-order?如果這是唯一的機制,我們錯過了一些並行化。 –