简体   繁体   English

使用wildfly-maven-plugin部署期间出错

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

I have a Maven multimodule project with the following structure: 我有一个具有以下结构的Maven多模块项目:

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

The cotacao project is the root, and cotacao-{core,service} are modules. cotacao项目是根,而cotacao-{core,service}是模块。 The cotacao-service is an EJB module that has the cotacao-core as a dependency. cotacao-service是一个以cotacao-core作为依赖项的EJB模块。 I'm using wildfly-maven-plugin to deploy the EJB cotacao-service . 我正在使用wildfly-maven-plugin部署EJB cotacao-service

Snippets of my pom.xml are: 我的pom.xml片段是:

(1) The cotacao project: (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) The cotacao-core project: (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) The cotacao-service project: (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>

I'm running the followin Maven goal wildfly:deploy and I'm getting the error: 我正在运行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
}

So, I don't know what's the problem with my Maven configurations. 因此,我不知道我的Maven配置有什么问题。 How can I use the wildfly-maven-plugin in order to deploy an EJB with the respective dependencies? 我如何使用wildfly-maven-plugin来部署具有各自依赖性的EJB? In my case, the cotacao-core is one of the required dependencies. 就我而言, cotacao-core是必需的依赖项之一。

Thanks! 谢谢!

You must 'cotacao-core' installed before do wildfly:deploy: 在执行wildfly:deploy之前,您必须先安装“ cotacao-core”

Try to change execution to install: 尝试更改执行以安装:

<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>

And simply launches : mvn install 并简单地启动:mvn install

I've not found out an elegant way of doing what I want. 我还没有找到一种优雅的方式来做自己想要的事情。 So, I've worked around this problem with the maven-shade-plugin . 因此,我已经使用maven-shade-plugin解决了这个问题。 The plugin was configured as follow. 插件配置如下。 There are two executions: one for the EJB itself, and another one for the EJB client. 有两种执行方式:一种用于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.

相关问题 在部署时使用Maven插件配置Wildfly Naming子系统wildfly-maven-plugin - Configure Wildfly Naming subsytem on deploy with Maven plugin wildfly-maven-plugin 启动并配置WildFly服务器,并在1个maven运行中使用wildfly-maven-plugin部署应用程序 - Start and configure a WildFly server and deploy the app using wildfly-maven-plugin in 1 maven run 仅Wildfly-Maven-Plugin耳与战争 - Wildfly-Maven-Plugin only Ear and War wildfly-maven-plugin-&gt;找不到前缀&#39;wildfly&#39;的插件 - wildfly-maven-plugin --> No plugin found for prefix 'wildfly' 如何通过wildfly-maven-plugin使用WildFly服务器运行服务? - how to run service with WildFly server by wildfly-maven-plugin? 无法执行目标org.wildfly.plugins:wildfly-maven-plugin:1.0.0.Final:deploy(default-cli)on project - Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.0.Final:deploy (default-cli) on project Maven在wildfly-maven-plugin:start之后挂起 - Maven hangs after wildfly-maven-plugin:start Maven wildfly-maven-plugin自定义standalone.xml - Maven wildfly-maven-plugin custom standalone.xml 使用wildfly-maven-plugin的add-resource数据源 - add-resource Data Source with wildfly-maven-plugin 如何使用wildfly-maven-plugin配置代理服务器? - How to configure proxy server with wildfly-maven-plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM