I am trying to deploy a simple HelloWorld servlet using JBoss EAP 6.2 and jboss-as-maven-plugin.
Here are the files :
Note on MySQL driver and JDBC Type 4 compliance: while the MySQL driver (at least up to 5.1.18) is designed to be a Type 4 driver, its jdbcCompliant method always return false. The reason is that the driver does not pass SQL 92 full compliance tests, says MySQL. Thus, you will need to install the MySQL JDBC driver as a module (see below).
- As you can see, the plugin contains two additional executions: a deploy-mysql execution which will deloy the MySQL JDBC Driver to the application server, and an add-datasource execution which will configure a datasource using this driver. In order to run this example, don't forget to add a dependency to MySQL JDBC driver in your pom.xml.
- Open Source JDBC Drivers. For open source JDBC drivers, buildomatic is setup so that there will be a single default driver used. If you would like to use a driver other than the default driver, you can modify the buildomatic property files that control which JDBC driver is used as the default.
- It's not normally necessary to install JDBC drivers as modules. The JDBC driver jar can be deployed as a jar using the CLI or by simply copying it into the 'deployments' directory. Possible reasons for using a module definition instead include: a) the driver is dependent upon other jars.
- Solution to Oracle jdbc driver issue. First you need to download jdbc driver from oracle website.; Download ojdbc7.jar; Now, you need to make this as module in Jboss wildfly so that it can load this as module.
pom.xml
web.xml
HelloWorld.java
The console messages of the server are the following :
stavross-mbp:Tmt-Project2 Administrator$ mvn clean install
[INFO] Scanning for projects..
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tmt-Project2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Tmt-Project2 ---
[INFO] Deleting /Users/Administrator/IdeaProjects/Tmt-Project2/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Tmt-Project2 ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/Administrator/IdeaProjects/Tmt-Project2/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Administrator/IdeaProjects/Tmt-Project2/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Tmt-Project2 ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ Tmt-Project2 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Tmt-Project2] in [/Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/Administrator/IdeaProjects/Tmt-Project2/src/main/webapp] Move downloads to sd card.
[INFO] Webapp assembled in [40 msecs]
[INFO] Building war: /Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT.war
[INFO]
[INFO] >>> jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
Jboss Deploy Jdbc Driver Maven Tutorial
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
Jboss Deploy Jdbc Driver Maven Dependency
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Administrator/IdeaProjects/Tmt-Project2/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Tmt-Project2 ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ Tmt-Project2 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Tmt-Project2] in [/Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/Administrator/IdeaProjects/Tmt-Project2/src/main/webapp]
[INFO] Webapp assembled in [4 msecs]
[INFO] Building war: /Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 <<<
Sql Server Jdbc Driver Maven
[INFO]
[INFO] --- jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 ---
[INFO] JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre
[INFO] JBOSS_HOME=/Users/Administrator/Servers/jboss-eap-6.2
[INFO] skip non existing resourceDirectory /Users/Administrator/IdeaProjects/Tmt-Project2/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Tmt-Project2 ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ Tmt-Project2 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Tmt-Project2] in [/Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/Administrator/IdeaProjects/Tmt-Project2/src/main/webapp] Move downloads to sd card.
[INFO] Webapp assembled in [40 msecs]
[INFO] Building war: /Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT.war
[INFO]
[INFO] >>> jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
Jboss Deploy Jdbc Driver Maven Tutorial
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
Jboss Deploy Jdbc Driver Maven Dependency
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Tmt-Project2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Administrator/IdeaProjects/Tmt-Project2/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Tmt-Project2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Tmt-Project2 ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ Tmt-Project2 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Tmt-Project2] in [/Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/Administrator/IdeaProjects/Tmt-Project2/src/main/webapp]
[INFO] Webapp assembled in [4 msecs]
[INFO] Building war: /Users/Administrator/IdeaProjects/Tmt-Project2/target/Tmt-Project2-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 <<<
Sql Server Jdbc Driver Maven
[INFO]
[INFO] --- jboss-as-maven-plugin:7.5.Final:run (running) @ Tmt-Project2 ---
[INFO] JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre
[INFO] JBOSS_HOME=/Users/Administrator/Servers/jboss-eap-6.2
[INFO] Server is starting up. Press CTRL + C to stop the server.
Jul 21, 2014 3:07:49 PM org.xnio.Xnio
INFO: XNIO Version 3.0.7.GA
Jul 21, 2014 3:07:49 PM org.xnio.nio.NioXnio
INFO: XNIO NIO Implementation Version 3.0.7.GA
Jul 21, 2014 3:07:49 PM org.jboss.remoting3.EndpointImpl
INFO: JBoss Remoting version 3.2.12.GA
15:07:50,279 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final-redhat-2
15:07:50,465 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
15:07:50,541 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) starting
15:07:51,201 INFO [org.xnio] (MSC service thread 1-10) XNIO Version 3.0.7.GA-redhat-1
15:07:51,202 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
15:07:51,206 INFO [org.xnio.nio] (MSC service thread 1-10) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
15:07:51,211 INFO [org.jboss.remoting] (MSC service thread 1-10) JBoss Remoting version 3.2.18.GA-redhat-1
15:07:51,239 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 29) JBAS010280: Activating Infinispan subsystem.
15:07:51,239 INFO [org.jboss.as.security] (ServerService Thread Pool -- 42) JBAS013171: Activating Security Subsystem
15:07:51,243 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 37) JBAS011800: Activating Naming Subsystem
15:07:51,246 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 35) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
15:07:51,248 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.19.SP2-redhat-1
15:07:51,269 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 46) JBAS015537: Activating WebServices Extension
15:07:51,285 INFO [org.jboss.as.connector.logging] (MSC service thread 1-13) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.23.Final-redhat-1)
Db2 Jdbc Driver Maven
15:07:51,294 INFO [org.jboss.as.naming] (MSC service thread 1-14) JBAS011802: Starting Naming Service
15:07:51,297 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
15:07:51,327 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
15:07:51,513 INFO [org.apache.coyote.http11] (MSC service thread 1-6) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/127.0.0.1:8090
15:07:51,519 INFO [org.apache.coyote.http11] (MSC service thread 1-6) JBWEB003000: Coyote HTTP/1.1 starting on: http-/127.0.0.1:8090
15:07:51,603 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final-redhat-1
15:07:51,622 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
Maven Jdbc Driver
15:07:51,656 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory /Users/Administrator/Servers/jboss-eap-6.2/standalone/deployments
15:07:51,661 INFO [org.jboss.as.server.deployment] (MSC service thread 1-13) JBAS015876: Starting deployment of 'Tmt-Project2-1.0-SNAPSHOT.war' (runtime-name: 'Tmt-Project2-1.0-SNAPSHOT.war')
15:07:51,669 INFO [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on 127.0.0.1:10009
15:07:51,669 INFO [org.jboss.as.remoting] (MSC service thread 1-12) JBAS017100: Listening on 127.0.0.1:4457
15:07:51,858 INFO [org.jboss.web] (ServerService Thread Pool -- 50) JBAS018210: Register web context: /Tmt-Project2-1.0-SNAPSHOT
15:07:52,134 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed 'Tmt-Project2-1.0-SNAPSHOT.war' (runtime-name : 'Tmt-Project2-1.0-SNAPSHOT.war')
15:07:52,139 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:10000/management
15:07:52,140 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:10000
15:07:52,140 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) started in 2157ms - Started 174 of 234 services (59 services are passive or on-demand)
Now if I go to http://localhost:8090/Tmt-Project2-1.0-SNAPSHOT/ I get the following errors :
JBWEB000309: type JBWEB000067: Status report
JBWEB000068: message/Tmt-Project2-1.0-SNAPSHOT/
JBWEB000069: descriptionJBWEB000124: The requested resource is not available.
JBoss Web/7.2.2.Final-redhat-1
WildFly Maven Plugin (wildfly-maven-plugin)
The wildfly-maven-plugin is used to deploy, redeploy, undeploy or run your application. You can also deploy or undeploy artifacts, such as JDBC drivers, and add or remove resources. There is also the ability to execute CLI commands.
Goals Overview
General information about the goals.
- wildfly:add-resource adds a resource.
- wildfly:deploy deploys the application to the application server.
- wildfly:deploy-only deploys the application to application server invoking no other goals by default.
- wildfly:deploy-artifact deploys an arbitrary artifact to the server.
- wildfly:redeploy redeploys the application.
- wildfly:redeploy-only redeploys the application invoking no other goals by default.
- wildfly:undeploy undeploys the application.
- wildfly:run runs the application server and deploys your application.
- wildfly:start starts the application server and leaves the process running. In most cases the shutdown goal be executed to ensure the server is shutdown.
- wildfly:shutdown shuts down a running application server.
- wildfly:execute-commands executes commands on the running server.
Usage
General instructions on how to use the WildFly Maven Plugin can be found on the usage page. Some more specific use cases are described in the examples given below. Last but not least, users occasionally contribute additional examples, tips or errata to the WildFly wiki page.
In case you still have questions regarding the plugin's usage, please have a look at the FAQ and feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.
If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.
Examples
To provide you with better understanding of some usages of the WildFly Maven Plugin, you can take a look into the following example: