Search code examples
javaspringhibernatemavenintellij-idea

How to dereference old Wildfly 9.0.1 deployment artifacts of Spring MVC app built with intelliJ-IDE?


I'm using intelliJ-IDE-14 to create a SpringMVC project named app which was initially being deployed to JBoss Wildfly 9.0.1.Final as app.war

Here's the step by step scenario leading up to my issue;

  • After finishing project config to utilize Maven | Spring | Hibernate | Wildfly | Velocity, then I made a copy of the project, refactored the new copy as demo and continued working on demo. That way, I could always re-use app as a barebones start-up template.

  • With that done, I then continued work on demo.

  • I configured maven to name output war file of demo to be ROOT.war

  • Also, just so I don't forget, I go back to app too and configured maven to name output war file of app as ROOT.war

  • Now I run demo, it gets deployed, hits the controller and displays landing page. All is fine, except when I check the logs I see the following exceptions being thrown while it is being deployed.

See 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

So essentially it means demo gets deployed fine, but in the process it can't find one file.

Notice this line;

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

Now this is quite strange as this file app.war shouldn't even exist in the context of demo anylonger because I had already done a complete refactoring. After inspecting the whole demo directory and not finding any reference to app.war then I thought it might just be an intelliJ referencing issue, so I undeployed demo cleaned the project, closed intelliJ, deleted the .idea folder and created a new maven project from the existing sources. Hoping this would clear any residues of app that may exist in demo, I ran demo again, but hit the same exception again.

Also, notice the first line in the pasted StackTrace;

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

This shows that Wildfly is first of all attempting to deploy app.war whereas it's demo.war that should be getting deployed because what i'm running is the demo project.

After everything, this leaves me suspecting the problem has to be in the scope of Wildfly, and that I might need to remove old references somewhere within Wildfly, but I am lost on ideas of what might be the underlying problem. Help would be much appreciated.

Thanks.


Solution

  • Solved this already. Turned out this wasn't particularly an intellij issue.

    For some reason, I found that in standalone.xml, the following lines that normally get automatically added at runtime (and always automatically removed when application is stopped) just refused to go...

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

    So I simply went in there and deleted those lines, so voila! error be gone!