title: Simple REST API with WildFly 8
body: <p>First off, I am new to this environment. I've developed Java before, but not for an application server. Having never done that, I've never worked with JBoss or WildFly previously. </p>
  
  <p>I've been able to set up and run the WildFly server, and access it at <code>127.0.0.1:9990</code>. When I deploy my <code>.war</code> file, the server doesn't react and I can't access the URLs. </p>
  
  <p>The WildFly server does state that my deployment succeeded and is active, then I try to access: <code>127.0.0.1:8080/RECAPP-API/rest/message/test</code> and I get a 404 (Page not found error).</p>
  
  <p>I'm using Maven, so first, my <code>pom.xml</code>:</p>
  
  <pre><code>&lt;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"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.test.recapp.rest&lt;/groupId&gt;
    &lt;artifactId&gt;RECAPP-API&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
  
    &lt;build&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.7&lt;/source&gt;
            &lt;target&gt;1.7&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
          &lt;version&gt;3.0.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jackson-provider&lt;/artifactId&gt;
          &lt;version&gt;3.0.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>My <code>JSONService.java</code>:</p>
  
  <pre><code>import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.PathParam;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.Response;
  
  @Path("/message")
  public class JSONService {
  
      @GET
      @Path("/{param}")
      @Produces("application/json")
      public Response printMessage(@PathParam("param") String msg) {
          String result = "Restful example: " + msg;
          return Response.status(200).entity(result).build();
      }
  
  }
  </code></pre>
  
  <p>And finally, my <code>web.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
      id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;RECAPP-API&lt;/display-name&gt;
  
    &lt;context-param&gt;
      &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
  
    &lt;context-param&gt;
      &lt;param-name&gt;resteasy.servlet.mapping.prefix&lt;/param-name&gt;
      &lt;param-value&gt;/rest&lt;/param-value&gt;
    &lt;/context-param&gt;
  
    &lt;listener&gt;
      &lt;listener-class&gt;org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
    &lt;/listener&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Thanks for your help.</p>