An odd situation occurred when the situation depicted as in the title of this article is happened. It is at the time of running or deploying a project using either IDE like Netbeans and then after that deploying the same or different project using a command line. The command line in the context of this article is the maven builder tool command line.
The command line executed is ‘mvn wildfly:deploy’ which is used to deploy an associated project where the command executed. The execution of this command to an already deployed application can trigger the following error message of a ‘duplicate resource’ :
0:40:34,124 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "webapp-1.0-SNAPSHOT.war")]) - failure description: "WFLYCTL0212: Duplicate resource [(\"deployment\" => \"webapp-1.0-SNAPSHOT.war\")]" 00:40:34,138 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
After try to search and googling around to solve the problem which at first the specified deployed application will be defined in the configuration file located in Wildfly Java Application Server, it turns out that the configuration file ‘standalone.xml’ which is used doesn’t have the deployment definition. After digging more, it turns out that there are another configuration file named ‘standalone-full.xml which is inserted with the deployment definition as shown in the following part of configuration lines :
<deployments> <deployment name="mysql-connector-java-8.0.11.jar" runtime-name="mysql-connector-java-8.0.11.jar"> <content sha1="edba0011304daa1b2648eb4848a44536acbbebf6"/> </deployment> <deployment name="webapp-1.0-SNAPSHOT.war" runtime-name="webapp-1.0-SNAPSHOT.war"> <content sha1="6ad13392a836d8a5bda935552e1e915cee3c266f"/> </deployment> </deployments>
The deployment name is ‘webapp-1.0-SNAPSHOT.war’ in the context of the above configuration part. To be able to solve the problem, just remove the deployment line part, so the standalone-full.xml will be edited as follows :
<deployments> <deployment name="mysql-connector-java-8.0.11.jar" runtime-name="mysql-connector-java-8.0.11.jar"> <content sha1="edba0011304daa1b2648eb4848a44536acbbebf6"/> </deployment> </deployments>
The one which is removed off course the deployment line of configuration which is causing the duplicate resource as shown above. After finish on editing the file, don’t forget to turn off and then start the Wildfly Java Application Server again. It is an action to implement the configuration file so that the running Wildfly Java Application Server will start running using the already edited configuration file. The editing process above by removing the deployment definition is actually solving the problem.