java - 如何取消引用使用 intelliJ-IDE 构建的 Spring MVC 应用程序的旧 Wildfly 9.0.1 部署 Artifact ?

标签 java spring hibernate maven intellij-idea

我正在使用 intelliJ-IDE-14 创建一个名为 app 的 SpringMVC 项目 最初部署到 JBoss Wildfly 9.0.1.Final 作为 app.war

这是导致我的问题的分步方案;

  • 完成项目配置后使用Maven | Spring | hibernate |野蝇 | Velocity,然后我复制了项目,将新副本重构为 demo 并继续致力于 demo 。这样,我总是可以重复使用 app 作为准系统启动模板。

  • 完成后,我继续 demo 的工作.

  • 我配置了 maven 来命名 的输出 war 文件 demo 成为 ROOT.war

  • 另外,为了不忘记,我回到 app 并配置 Maven 来命名 app 的输出 war 文件 作为 ROOT.war

  • 现在我运行 demo ,它被部署,点击 Controller 并显示登陆页面。一切都很好,除了当我检查日志时,我看到在部署时抛出以下异常。

查看 StackTrace;

INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "app.war" (runtime-name: "app.war")
INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) WFLYDS0013: Started FileSystemDeploymentService for directory C:\jBoss\wildfly-9.0.1.Final\standalone\deployments
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."app.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."app.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "app.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
    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:156)
... 5 more
Caused by: java.io.FileNotFoundException: C:\project-path\demo\target\app.war (The system cannot find the file specified)
    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:254)
    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

[INFO]...//(omitted for brevity)

ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "app.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"app.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"app.war\".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment \"app.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0160: Failed to mount deployment content
    Caused by: java.io.FileNotFoundException: C:\\project-path\\demo\\target\\app.war (The system cannot find the file specified)"}}
21:08:21,658 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "app.war" (runtime-name : "app.war")
21:08:21,667 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."app.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."app.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "app.war"

INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
20:32:13,137 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
20:32:13,137 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started (with errors) in 7442ms - Started 205 of 383 services (1 services failed or missing dependencies, 211 services are lazy, passive or on-demand)
Connected to server
[2015-10-24 08:32:15,100] Artifact demo:war: Artifact is being deployed, please wait...

[INFO]... //(omitted for brevity)

WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."app.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."app.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "app.war"
[2015-10-24 08:32:30,629] Artifact demo:war: Artifact is deployed successfully

从本质上讲,这意味着演示可以正常部署,但在此过程中找不到一个文件。

注意这一行;

Caused by: java.io.FileNotFoundException: C:\project-path\demo\target\app.war (The system cannot find the file specified)

现在这很奇怪,因为这个文件 app.war 甚至不应该存在于 demo 的上下文中 不再是因为我已经完成了完整的重构。整后检查<强>demo 目录,但未找到对 app.war 的任何引用 然后我认为这可能只是一个 intelliJ 引用问题,所以我取消部署了 demo 清理项目,关闭 intelliJ,删除 .idea 文件夹并从现有源创建一个新的 maven 项目。希望这会清除 app 的任何残留物 可能存在于 demo ,我跑了 demo 再次发生,但再次遇到相同的异常。

另外,请注意粘贴的 StackTrace 中的第一行;

INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "app.war" (runtime-name: "app.war")

这表明 Wildfly 首先尝试部署 app.war 而它是 demo.war 应该部署,因为我正在运行的是 demo 项目。

毕竟,这让我怀疑问题一定是在 Wildfly 的范围内,我可能需要删除 Wildfly 内某处的旧引用,但我对潜在问题可能是什么一无所知。非常感谢您的帮助。

谢谢。

最佳答案

这个已经解决了。事实证明,这并不是一个特别的 intellij 问题。

出于某种原因,我发现在 standalone.xml 中,通常会在运行时自动添加以下行(并且总是在应用程序运行时自动删除停止)只是拒绝去...

<deployments>
    <deployment name="app.war" runtime-name="app.war">
            <fs-archive path="C:\project-path\demo\target\app.war"/>
    </deployment>
</deployments>

所以我只是进去删除了那些行,所以瞧!错误消失了!

关于java - 如何取消引用使用 intelliJ-IDE 构建的 Spring MVC 应用程序的旧 Wildfly 9.0.1 部署 Artifact ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33323907/

相关文章:

hibernate - JPA 中所有 NamedQueries 的列表

java - DDD 中的存储库层

java - 带自定义适配器的 ListView 不加载标题数组,仅使用抽屉导航加载 0

java - 任何自动化 Eclipse 工作区设置的方法?

java - jprofiler 在堆分析期间给出未知的类名

java - Java Spring MVC 中@Scheduled 注解中常量表达式的使用

java - 将其他证书添加到现有 jks 或不使用 javax.net.ssl.trustStore 进行请求

spring - 无法访问 Amazon SQS - InvalidClientTokenId

java - 无法将数据持久保存到多对多映射实体中

sql - 使用 Hibernate 进行不区分大小写的搜索