如何指定ejb和war在耳内部署的部署顺序?

时间:2018-07-24 16:35:01

标签: maven deployment ear ejb-3.1 jboss-eap-7

我创建了一个maven ear项目,该项目由1个jar,5个EJB和1个war组成。但是,当我尝试将其部署在服务器JBOSS EAP 7.0上时,不遵守application.xml中的部署顺序。由于这个问题,我收到以下错误:

ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ear_module.ear")]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.module.service.\"deployment.ear_module.ear.war_module-0.0.1-SNAPSHOT.war\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb5.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main, module.resolved.service.\"deployment.ear_module.ear.war_module-0.0.1-SNAPSHOT.war\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment..ear.war_module-0.0.1-SNAPSHOT.war\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb5.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.ejb5-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, module.resolved.service.\"deployment.ear_module.ear.ejb5-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.ejb5-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.jar1-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.ejb1-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.ejb2-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.premap_execution_server-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.ejb4-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.ejb1-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, module.resolved.service.\"deployment.ear_module.ear.ejb1-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.resolve.phase.\"deployment.ear_module.ear.ejb3-0.0.1-SNAPSHOT.jar\".main.1 is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.ejb3-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, module.resolved.service.\"deployment.ear_module.ear.ejb3-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.ejb4-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, module.resolved.service.\"deployment.ear_module.ear.ejb4-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.premap_execution_server-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, module.resolved.service.\"deployment.ear_module.ear.premap_execution_server-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, module.resolved.service.\"deployment.ear_module.ear\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.jar1-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, module.resolved.service.\"deployment.ear_module.ear.jar1-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]",
    "jboss.module.service.\"deployment.ear_module.ear.ejb2-0.0.1-SNAPSHOT.jar\".main is missing [jboss.module.spec.service.\"deployment.jar1.jar\".main, jboss.module.spec.service.\"deployment.ejb3.jar\".main, module.resolved.service.\"deployment.ear_module.ear.ejb2-0.0.1-SNAPSHOT.jar\".main, jboss.module.spec.service.\"deployment.ejb2.jar\".main, jboss.module.spec.service.\"deployment.ejb4.jar\".main, jboss.module.spec.service.\"deployment.ejb1.jar\".main]"
]}

我尝试了所有可能的方法,但是问题仍然存在。谁能建议我在这里做错了。

编辑: 耳朵pom.xml

<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>Grpmodule</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>ear_module</artifactId>
<packaging>ear</packaging>

<dependencies>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>jar1</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>jar</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>ejb1</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>ejb2</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>ejb3</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>ejb4</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>ejb5</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
         <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>Grpmodule</groupId>
        <artifactId>war_module</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
         <scope>provided</scope> 
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.10.1</version>
            <configuration>

                   <initializeInOrder>true</initializeInOrder>
                <modules>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>jar1</artifactId>
                    </ejbModule>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>ejb1</artifactId>
                    </ejbModule>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>ejb2</artifactId>
                    </ejbModule>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>ejb3</artifactId>
                    </ejbModule>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>ejb4</artifactId>
                    </ejbModule>
                    <ejbModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>ejb5</artifactId>
                    </ejbModule>
                    <webModule>
                        <groupId>Grpmodule</groupId>
                        <artifactId>war_module</artifactId>
                        <uri>war_module-0.0.1-SNAPSHOT.war</uri>
                        <contextRoot>/application</contextRoot>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

父pom.xml:-

<modelVersion>4.0.0</modelVersion>


<groupId>Grpmodule</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>PREMAP : Parent</name>
<description>This project only contains POM which defines the dependency for the other projects which are defined as modules</description>
<contributors />
<developers />
<modules>
    <module>../jar1</module>
    <module>../ejb1</module>
    <module>../ejb2</module>
    <module>../ejb3</module>
    <module>../ejb4</module>
    <module>../ejb5</module>
    <module>../war_module</module>
    <module>../ear</module>
</modules>   

1 个答案:

答案 0 :(得分:0)

您可以使用jboss-all.xml部署描述符文件来指定依赖项。对于war文件,这应该放在WEB-INF下;对于EAR文件,应该放在META-INF下。

例如,如果要在ejb1之前部署JAR1。然后,您需要在ejb1内的jboss-all.xml中为JAR1指定依赖项,依此类推。

<jboss umlns="urn:jboss:1.0">
 <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
  <dependency name="JAR1.jar" />
 </jboss-deployment-dependencies>
</jboss>