4 Replies Latest reply on Jul 22, 2014 5:04 PM by James Perkins

    Deploy a simple application on JBoss EAP 6.2 using jboss-as-maven-plugin

    Stavros Kefaleas Newbie

      I am trying to deploy a simple HelloWorld servlet using JBoss EAP 6.2 and jboss-as-maven-plugin.

       

      Here are the files :

       

      pom.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
      
      
          <groupId>com.skiabox.webapps</groupId>
          <artifactId>Tmt-Project2</artifactId>
          <version>1.0-SNAPSHOT</version>
          <packaging>war</packaging>
      
      
          <dependencies>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.11</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>javax.servlet-api</artifactId>
                  <version>3.0.1</version>
                  <scope>provided</scope>
              </dependency>
          </dependencies>
      
      
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>3.1</version>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-war-plugin</artifactId>
                      <version>2.4</version>
                      <configuration>
                          <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                          <warName>${plugin.war.warName}</warName>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.jboss.as.plugins</groupId>
                      <artifactId>jboss-as-maven-plugin</artifactId>
                      <version>7.5.Final</version>
                      <executions>
                          <execution>
                              <id>running</id>
                              <phase>pre-integration-test</phase>
                              <goals>
                                  <goal>run</goal>
                              </goals>
                              <configuration>
                                  <jbossHome>/Users/Administrator/Servers/jboss-eap-6.2</jbossHome>
                                  <hostname>localhost</hostname>
                                  <username>admin</username>
                                  <password>skia0987!</password>
                              </configuration>
                          </execution>
                          <execution>
                              <id>deploying</id>
                              <phase>install</phase>
                              <goals>
                                  <goal>deploy</goal>
                              </goals>
                              <configuration>
                                  <filename>target/Tmt-Project2-1.0-SNAPSHOT.war</filename>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      
      
      
      
      </project>
      
      
      
      
      
      
      
      
      
      
      

       

       

      web.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
               version="2.5">
      
      
          <servlet>
              <servlet-name>HelloWorld</servlet-name>
              <servlet-class>gui.HelloWorld</servlet-class>
          </servlet>
          
          <servlet-mapping>
              <servlet-name>HelloWorld</servlet-name>
              <url-pattern>/servlet/HelloWorld</url-pattern>
          </servlet-mapping>
      </web-app>
      

       

       

      HelloWorld.java

       

      package gui;
      
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      
      /**
       * Created by Administrator on 7/17/14.
       */
      public class HelloWorld extends javax.servlet.http.HttpServlet {
          protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
      
      
          }
      
      
          protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
              PrintWriter out = response.getWriter();
      
      
              out.println("<html>");
              out.println("<b>Hello World</b>");
              out.println("</html>");
          }
      }
      

       

       

      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]

      [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]

      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Tmt-Project2 ---

      [INFO] Nothing to compile - all classes are up to date

      [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 <<<

      [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 <clinit>

      INFO: XNIO Version 3.0.7.GA

      Jul 21, 2014 3:07:49 PM org.xnio.nio.NioXnio <clinit>

      INFO: XNIO NIO Implementation Version 3.0.7.GA

      Jul 21, 2014 3:07:49 PM org.jboss.remoting3.EndpointImpl <clinit>

      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)

      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]

      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 :

       

      JBWEB000065: HTTP Status 404 - /Tmt-Project2-1.0-SNAPSHOT/


      JBWEB000309: type JBWEB000067: Status report

      JBWEB000068: message /Tmt-Project2-1.0-SNAPSHOT/

      JBWEB000069: description JBWEB000124: The requested resource is not available.


      JBoss Web/7.2.2.Final-redhat-1