Search code examples
javamavendeploymentjboss

org.jboss.msc.service.DuplicateServiceException Service jboss.undertow.deployment.default-server.default-host/ap-ejb-web.UndertowDeploymentInfoService


I am experiencing issues with a myapp-ear project. Here is the error I am getting after running mvn clean install and mvn wildfly:deploy. Does anyone have any suggestions?

 [INFO] ejb-ear ............................................ FAILURE [ 
 1.617 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
 ------------------------------------------------------------------------ [INFO] Total time:  3.089 s [INFO] Finished at:
 2022-09-26T23:16:43-06:00 [INFO]
 ------------------------------------------------------------------------ [ERROR] Failed to execute goal
 org.wildfly.plugins:wildfly-maven-plugin:2.0.1.Final:deploy
 (default-cli) on project myapp-ear: Failed to execute goal deploy:
 {"WFLYCTL0062: Composite operation failed and was rolled back. Steps
 that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed
 services" =>
 {"jboss.deployment.subunit.\"myapp-ear.ear\".\"myapp-ejb-web.war\".INSTALL"
 => "WFLYSRV0153: Failed to process phase INSTALL of subdeployment \"myapp-ejb-web.war\" of deployment \"myapp-ear.ear\" [ERROR]    
 Caused by: org.jboss.msc.service.DuplicateServiceException: Service
 jboss.undertow.deployment.default-server.default-host./myapp-ejb-web.UndertowDeploymentInfoService
 is already registered"},"WFLYCTL0412: Required services that are not
 installed:" =>
 ["jboss.deployment.subunit.\"myapp-ear.ear\".\"myapp-ejb-web.war\".deploymentCompleteService"],"WFLYCTL0180:
 Services with missing/unavailable dependencies" =>
 ["jboss.deployment.unit.\"myapp-ear.ear\".deploymentCompleteService is
 missing
 [jboss.deployment.subunit.\"myapp-ear.ear\".\"myapp-ejb-web.war\".deploymentCompleteService]"]}}}
 [ERROR] -> [Help 1]

UPDATE:

Here is my application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version="7">
  <description>This project packages myapp-ejb and myapp-ejb-web in an EAR; this is the EAR POM file</description>
  <display-name>myapp-ear</display-name>
  <module>
    <web>
      <web-uri>myapp-ejb-web.war</web-uri>
      <context-root>/myapp-ejb-web</context-root>
    </web>
  </module>
  <module>
    <ejb>myapp-ejb.jar</ejb>
  </module>
  <library-directory>lib</library-directory>
</application>

UPDATE 2:

Also, here is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>myapp.lab</groupId>
    <artifactId>myapp-ear</artifactId>
    <packaging>ear</packaging>
    <name>ejb-ear</name>
    <parent>
        <groupId>myapp.lab</groupId>
        <artifactId>myapp-app</artifactId>
        <version>0.1.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <description>This project packages myapp-ejb and myapp-ejb-web in an EAR; this is the EAR POM file</description>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>myapp-ejb</artifactId>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>myapp-ejb-web</artifactId>
            <type>war</type>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <version>7</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <modules>
                        <webModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>myapp-ejb-web</artifactId>
                            <contextRoot>/myapp-ejb-web</contextRoot>
                        </webModule>
                    </modules>
                    <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

UPDATE 3:

If I add the -e flag to the mvn wildfly:deploy then this is what I see:

Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"myapp-ear.ear\".\"myapp-ejb-web.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of subdeployment \"myapp-ejb-web.war\" of deployment \"myapp-ear.ear\"
    Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.undertow.deployment.default-server.default-host./myapp-ejb-web.UndertowDeploymentInfoService is already registered"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.subunit.\"ec-ear.ear\".\"ec-ejb-web.war\".deploymentCompleteService"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"myapp-ear.ear\".deploymentCompleteService is missing [jboss.deployment.subunit.\"myapp-ear.ear\".\"myapp-ejb-web.war\".deploymentCompleteService]"]}}}

So to me it sounds like the error says that the required service myapp-ear.ear is not installed because the dependency myapp-ear.ear is not installed which makes no sense to me.


Solution

  • Execute these steps:

    1. Inside %JBOSS_HOME%\standalone\deployments, delete all *.failed files.
    2. In %JBOSS_HOME%\standalone\configuration, edit standalone.xml and find deployments element. Remove them.
    3. Redeploy