我如何取消部署 WildFly 中的所有工件?

How do I undeploy all artifacts from WildFly?

我正在开发 Web 应用程序并(使用 IntelliJ)部署到 WildFly 10.1。我最近重命名了我的 webapp 模块,这导致我的 war 文件从 foo.war 重命名为 bar.war。每次启动时,我都会收到此错误:

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

请注意,部署(和取消部署)重命名的 war 工作正常。我只是无法取消部署旧 war.

的剩余部分

如何从 WildFly 中取消部署所有工件以重新开始?

这里有多个选项:

  1. 通过 Maven

    • 将 wildfly 插件参数 matchPattern and matchPatternStrategy 添加到 pom.xml 部分的 <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>
      

      (遗憾的是没有预定义相应的 CLI 属性)

    • 和 运行 来自控制台

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

      (或在您的 IDE 中设置等效的 运行 配置

  2. 通过 WildFly 命令行界面 (CLI):

    • 运行 jboss-cli -c controller=https-remoting://XXX:9993 -u=XXX
    • 输入您的密码,然后
    • undeploy(按TAB发现神器)
  3. 通过 WildFly Web 管理界面:

    • 访问例如https://XXX:9993/console/App.html#standalone-deployments
    • select 工件并从下拉菜单中选择 'Remove'