javaintellij-ideajbosswildflywildfly-10

How do I undeploy all artifacts from WildFly?


I am developing a web application and deploying (with IntelliJ) to WildFly 10.1. I recently renamed my webapp module, which results in renaming my war file from foo.war to bar.war. Every time I start up, I get this error:

12:24:15,899 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."foo_war_exploded.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."foo_war_exploded.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "foo_war_exploded.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0160: Failed to mount deployment content
    at org.jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:95)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
    ... 5 more
Caused by: java.io.FileNotFoundException: /.../foo_war_exploded (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.jboss.vfs.spi.RootFileSystem.openInputStream(RootFileSystem.java:51)
    at org.jboss.vfs.VirtualFile.openStream(VirtualFile.java:318)
    at org.jboss.vfs.VFS.mountZipExpanded(VFS.java:533)
    at org.jboss.as.server.deployment.DeploymentMountProvider$Factory$ServerDeploymentRepositoryImpl.mountDeploymentContent(DeploymentMountProvider.java:108)
    at org.jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:91)
    ... 6 more
...
[2017-04-23 12:24:18,957] Artifact bar:war exploded: Artifact is deployed successfully

Notice that deploying (and undeploying) the renamed war works fine. I just can't undeploy the leftover of the old war.

How do I undeploy all artifacts from WildFly to make a fresh start?


Solution

  • You have multiple options here:

    1. via Maven:

      • add the wildfly plugin parameters matchPattern and matchPatternStrategy to your pom.xml in the section <project><build><plugins>:

        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <configuration>
                <!-- use regular expressions here -->
                <matchPattern>(foo|bar).war</matchPattern>
                <matchPatternStrategy>all</matchPatternStrategy>
            </configuration>
        </plugin>
        

        (unfortunately there are no predefined corresponding CLI properties)

      • and run from a console

        mvn wildfly:undeploy -Dwildfly.hostname=XXX -Dwildfly.port=9993 -Dwildfly.username=XXX -Dwildfly.password=XXX -Dwildfly.protocol=https-remoting

        (or setup an equivalent run configuration in your IDE)

    2. via WildFly Command Line Interface (CLI):

      • run jboss-cli -c controller=https-remoting://XXX:9993 -u=XXX
      • type in your password and then
      • undeploy (discover artifacts by pressing TAB)
    3. via WildFly Web Management Interface:

      • visit e.g. https://XXX:9993/console/App.html#standalone-deployments
      • select the artifact and choose 'Remove' from the dropdown menu