Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong war file name in deployment directory

I am having a "404 Not found" error message when visiting at: http://localhost:8080/bword in Eclipse.

This application is served in Wildfly. In POM.xml, it defines:

<artifactId>bword</artifactId>
<packaging>war</packaging>
<name>bword</name>

However, strange enough, when I run the application in Eclipse with Wildfly 9.0 configured as the server, what's deployed into wildfly/standone/deployments/ is bbword.war, as below:

[abigail@localhost wildfly-9.0.2.Final]$ ls standalone/deployments/
bbword.war/          bbword.war.deployed 

Which is wrong, it should be "bword.war/" and "bword.war.deployed".

Outside of Eclipse, if I "mvn clean package" under the project "bword", I can get the "bword.war" under the target/ directory.

Please see the attachment screenshot for reference. I suspect somewhere in my pom, or eclipse, or whatever place, there is a misconfiguration of "bbword", instead of "bword", but I can't really find it. I can't find any trace of "bbword". What dictates the name of the deployed war file under deployments?

See attached.

enter image description here

Edited (Part of the POM.xml):

<build>
            <!-- Set the name of the war, used as the context root when the app 
                is deployed -->
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${version.war.plugin}</version>
                    <configuration>
                        <!-- Java EE 7 doesn't require web.xml, Maven needs to catch up! -->
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <!-- WildFly plugin to deploy war -->
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>${version.wildfly.maven.plugin}</version>
                </plugin>
                <!-- Compiler plugin enforces Java 1.6 compatibility and activates 
                    annotation processors -->
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.compiler.plugin}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

One more addition:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
17:32:35,508 INFO  [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
17:32:35,702 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
17:32:35,761 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
17:32:36,573 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 22) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
17:32:36,594 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found bbword.war in deployment directory. To trigger deployment create a file called bbword.war.dodeploy
17:32:36,625 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
17:32:36,647 INFO  [org.xnio] (MSC service thread 1-5) XNIO version 3.3.1.Final

......

This is the very initial section of the console message after I click "Run as Server" on Wildfly. It seems that it shows "Found bbword.war in deployment directory." Before I run it, I delete all in standalone/deployments/*. It start with an empty directory. It seems the "bbword.war" is copied to this directory whenever I run the server. I can't figure out. I use "find / -name bbword.war" on my computer but can't find this file. Really puzzled.

Update on this:

Eventually found out the problem: under the project 'bword', there is a ".setting" directory, which contains this file: bword/.settings/org.eclipse.wst.common.component

And there is a line in it: , where "bbword" was the previous deploy name I used. Remove this directory and in Maven, run "update" seems fixing this problem. In particular, I need to do both, first delete this dirctory, .setting, then update maven.

Several days wasted on this, but it's good to know about this.

like image 734
user697911 Avatar asked Dec 12 '15 07:12

user697911


2 Answers

Had the same issue and fixed it by having corrected those 2 files :

.settings/org.eclipse.wst.common.component =>deploy-name, etc

.project =>name

like image 113
SylvainP Avatar answered Oct 23 '22 13:10

SylvainP


First, try deploying the maven-built artifact (bword.war) on your server(Do not forget to completely clean-up any Eclipse deployed artifacts first).
You can do this by simply moving the bword.war from your /target folder to your path_to_wildfly/standalone/deployments folder.
Check the server log file for message: Registered web context: <web_context_name> that should appear once your war is deployed. If it says /bbword - which is not what you expect, check whether you have a jboss-web.xml file in src/main/webapp/WEB-INF that specifies this as a web-context value.

If the maven artifact results in correct webcontext - /bword, then it must be an Eclipse configuration issue. Have you tried updating the Eclipse project from Maven? :

  1. right click on your project
  2. select Maven
  3. select Update Project
  4. remove your project from Wildfly server, and add it again. If that does not help, try adding a new server runtime and add your project there. Last resort would be to create a new Eclipse workspace.

Good luck.

like image 1
yntelectual Avatar answered Oct 23 '22 12:10

yntelectual