3

I'm trying to use the maven wildfly plugin to deploy my .war to my application server.

So I have this configured in IntelliJ, and it deploys the war for me, but I want to use maven so I can also deploy with jenkins.

When I call mvn wildfly:deploy I get the following error:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.2.1.Final:deploy (default-cli) on project Kwetter: Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "WFLYSRV0205: There is already a deployment called Kwetter.war with the same runtime name Kwetter.war"}}

So I went to the jboss-cli.bat and tried to remove undeploy the .war. But when I go there and call undeploy Kwetter.war I get:

Undeploy failed: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "WFLYCTL0216: Management resource '[(\"deployment\" => \"Kwetter.war\")]' not found"}}

When I try to undeploy *.war I get the same error, so it seems that there is nothing deployed?

I also tried to add force = true in my pom.xml so it would override the already existing .war but this just gives me the same error.

I included my pom.xml for reference:

<repositories>
    <repository>
        <id>maven2-repository.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/2/</url>
        <layout>default</layout>
    </repository>
</repositories>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

<build>
    <finalName>Kwetter</finalName>
    <plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.2.1.Final</version>
            <configuration>
                <!--change management console port-->
                <port>9990</port>
                <!--redeploy if exists-->
                <force>true</force>
                <username>newadmin</username>
                <password>newadmin</password>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <!-- The profile to execute wildfly managed integration tests.
        Other profiles similar to this could be created for other container adapters-->
        <id>wildfly</id>
        <!-- the dependencies for Wildfly  -->
        <dependencies>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-arquillian-container-managed</artifactId>
                <version>8.2.1.Final</version>
            </dependency>

            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-embedded</artifactId>
                <version>8.2.1.Final</version>
            </dependency>

        </dependencies>
        <build>
            <testResources>
                <testResource>
                    <directory>src/test/resources</directory>
                </testResource>
                <testResource>
                    <directory>src/test/resources-jbossas-managed</directory>
                </testResource>
            </testResources>
        </build>
    </profile>
</profiles>

  <!-- https://mvnrepository.com/artifact/javax.faces/jsf-api -->
  <dependency>
      <groupId>javax.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
  <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.wildfly/wildfly-dist -->
  <dependency>
      <groupId>org.wildfly</groupId>
      <artifactId>wildfly-dist</artifactId>
      <version>11.0.0.Final</version>
  </dependency>

  <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <version>1.3.0.Final</version>
  </dependency>

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>8.2.1.Final</version>
</dependency>

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-embedded</artifactId>
    <version>8.2.1.Final</version>
</dependency>

  <!--Junit-->
  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
  </dependency>

  <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-7.0</artifactId>
      <version>1.0.3.Final</version>
      <type>pom</type>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax/javaee-api -->
  <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>7.0</version>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.persistence/persistence-api -->
  <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>persistence-api</artifactId>
      <version>1.0.2</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
  <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.1</version>
  </dependency>
  <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.8.9</version>
  </dependency>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.3.0.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

BartKrul
  • 577
  • 1
  • 8
  • 21
  • Please read [Why is β€œCan someone help me?” not an actual question?](https://meta.stackoverflow.com/questions/284236/why-is-can-someone-help-me-not-an-actual-question) before attempting to ask more questions. –  Mar 23 '18 at 14:13
  • 2
    Meh, the question seems alright to me, probably because I'm familiar with what OP is trying to achieve. He wants to deploy his application to his server using a maven plugin, it failed with a comprehensible error message, he applied the obvious solution but it failed so he's here to ask for help. If you prefer, the question is "How can I deploy a new version of an application that is already deployed on my Wildfly using wildfly-maven-plugin". – Aaron Mar 23 '18 at 14:22

3 Answers3

9

I have found where the problem is. I run application from inteiij and some time I have got error with that the application is deployed.

  1. stop wildfy
  2. go to sandalone.xml
  3. remove deployments section
  <deployments>
    <deployment name="xxx.war" runtime-name="xxx.war">
    <fs-archive path="...\xxx.war"/>
    </deployment>
    </deployments>
Krzysztof G
  • 91
  • 1
  • 2
4

I'm not 100% sure what exactly the problem was. But I was able to find a deployment that was active in wildfly's admin console. (Why it didn't show up in CLI, I don't know). When I removed the deployment there using the UI, I was able to run the mvn deploy command, and deploy the .war. Also when I run the mvn deploy command again, it removes the old .war and put's the newly build one there.

Check this topic for reference: How do I undeploy all artifacts from WildFly?

BartKrul
  • 577
  • 1
  • 8
  • 21
0

I recently faced this issue. I figured that standalone.xml file under JBoss installation directory had an archived deployment tag. Once I removed that it fixed the issue.

Sujoy
  • 802
  • 11
  • 22