簡體   English   中英

使用wildfly-maven-plugin部署期間出錯

[英]Error during the deploy with wildfly-maven-plugin

我有一個具有以下結構的Maven多模塊項目:

- cotacao
-- cotacao-core
-- cotacao-service

cotacao項目是根,而cotacao-{core,service}是模塊。 cotacao-service是一個以cotacao-core作為依賴項的EJB模塊。 我正在使用wildfly-maven-plugin部署EJB cotacao-service

我的pom.xml片段是:

(1) cotacao項目:

<groupId>com.tnas</groupId>
<artifactId>cotacao</artifactId>
<version>1.0</version>
<name>Cotacao Parent Project</name>
<packaging>pom</packaging>

<modules>
    <module>cotacao-service</module>
    <module>cotacao-core</module>
</modules>

(2) cotacao-core項目:

<parent>
    <groupId>com.tnas</groupId>
    <artifactId>cotacao</artifactId>
    <version>1.0</version>
</parent>

<groupId>com.fincatto</groupId>
<artifactId>cotacao-core</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cotacao Core</name>

(3) cotacao-service項目:

<parent>
    <groupId>com.tnas</groupId>
    <artifactId>cotacao</artifactId>
    <version>1.0</version>
</parent>

<artifactId>cotacao-service</artifactId>
<version>1.0.0</version>
<packaging>ejb</packaging>
...
<dependencies>
    ...
    <dependency>
        <groupId>com.fincatto</groupId>
        <artifactId>cotacao</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

<build>  
    <plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>${wildfly.plugin.version}</version>
            <executions>
                <execution>
                    <id>deploy-cotacao-core-dependency</id>
                    <phase>package</phase>
                    <goals>
                        <goal>deploy-artifact</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                        <project>
                            <dependencies>
                                <dependency>
                                    <groupId>com.fincatto</groupId>
                                    <artifactId>cotacao-core</artifactId>
                                </dependency>
                            </dependencies>
                        </project>
            </configuration>                    
        </plugin>
        ...
      </plugins>
   </build>

我正在運行followin Maven目標wildfly:deploy ,但出現錯誤:

15:34:03,183 ERROR [org.jboss.as.server] (management-handler-thread - 36) WFLYSRV0021: Deploy of deployment "cotacao-service-1.0.0.jar" was rolled back with the following failure message: 
{
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"cotacao-service-1.0.0.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"cotacao-service-1.0.0.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"cotacao-service-1.0.0.jar\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class com.tnas.cotacao.service.BACENService with ClassLoader ModuleClassLoader for Module \"deployment.cotacao-service-1.0.0.jar:main\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lcom/fincatto/cotacao/ws/WSConsulta;
    Caused by: java.lang.ClassNotFoundException: com.fincatto.cotacao.ws.WSConsulta from [Module \"deployment.cotacao-service-1.0.0.jar:main\" from Service Module Loader]"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"cotacao-service-1.0.0.jar\".POST_MODULE"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}

因此,我不知道我的Maven配置有什么問題。 我如何使用wildfly-maven-plugin來部署具有各自依賴性的EJB? 就我而言, cotacao-core是必需的依賴項之一。

謝謝!

在執行wildfly:deploy之前,您必須先安裝“ cotacao-core”

嘗試更改執行以安裝:

<dependencies>
    ...
    <dependency>
        <groupId>com.fincatto</groupId>
        <artifactId>cotacao-core</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

<plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>${wildfly.plugin.version}</version>
            <executions>
                <execution>
                    <id>deploy-cotacao-core-dependency</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deploy-artifact</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>                    
                    <groupId>com.fincatto</groupId>
                    <artifactId>cotacao-service</artifactId>
                   </dependency>                            
            </configuration>                    
        </plugin>
        ...
      </plugins>

並簡單地啟動:mvn install

我還沒有找到一種優雅的方式來做自己想要的事情。 因此,我已經使用maven-shade-plugin解決了這個問題。 插件配置如下。 有兩種執行方式:一種用於EJB本身,另一種用於EJB客戶端。

        <!-- Usage: mvn:package -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>${shade.plugin.version}</version>
            <executions>
                <execution>
                    <id>shade-ejb-service</id>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <outputFile>${ejb.fileName}.jar</outputFile>
                        <artifactSet>
                            <includes>
                                <!-- Here I've included every dependencies -->
                                <include>groupId:artifactId</include>
                            </includes>
                        </artifactSet>
                    </configuration>
                </execution>
                <execution>
                    <id>shade-ejb-client</id>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <outputFile>${ejb.fileName}-client.jar</outputFile>
                        <artifactSet>
                            <includes>
                                <!-- Only dependencies for the client -->
                                <include>groupId:artifactId</include>
                            </includes>
                        </artifactSet>
                        <!-- Filters for selecting specific client classes -->
                        <filters>
                            <filter>
                                <artifact>com.fincatto:cotacao-core</artifact>
                                <includes>
                                    <include>com/fincatto/cotacao/classes/*</include>
                                </includes>
                            </filter>
                            <filter>
                                <artifact>com.tnas:cotacao-service</artifact>
                                <includes>
                                    <include>com/tnas/cotacao/service/remote/*</include>
                                </includes>
                            </filter>
                        </filters>
                    </configuration>
                </execution>
            </executions>
        </plugin>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM