title: Basic chat application using java and Atmosphere
body: <p>I am trying to get a simple <a href="https://github.com/Atmosphere/atmosphere/wiki/Getting-Started-with-The-Atmosphere-Framework-and-WebSocket" rel="nofollow noreferrer">example</a> of a Atmosphere chat program working with Glassfish and Jersery.</p>
  
  <p>So far I have a basic maven webapp archetype with the following structure:</p>
  
  <p><img src="https://i.stack.imgur.com/UNsD2.png" alt="project setup"></p>
  
  <p>The chat resource file is just a simple REST service using the Atmosphere annotations:</p>
  
  <pre><code>package core;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  
  import org.atmosphere.annotation.Broadcast;
  import org.atmosphere.annotation.Suspend;
  
  @Path("/")
  public class ChatResource {
  
      @Suspend(contentType = "application/json")
      @GET
      public String suspend() {
          return "";
      }
  
      @Broadcast(writeEntity = false)
      @POST
      @Produces("application/json")
      public Response broadcast(Message message) {
          return new Response(message.author, message.message);
      }
  }
  </code></pre>
  
  <p>The message and response classes are just simple POJO wrappers. The index.jsp, application.js, jquery.atmosphere.js and jquery.js are copied directly from the example project (found <a href="https://github.com/Atmosphere/atmosphere/tree/master/samples/rest-chat" rel="nofollow noreferrer">here</a>).</p>
  
  <p>My web.xml is set to the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  
      &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;description&gt;AtmosphereServlet&lt;/description&gt;
          &lt;servlet-name&gt;AtmosphereServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.atmosphere.cpr.AtmosphereServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;0&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;AtmosphereServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/chat/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>When navigating to the page, I receive the following error:</p>
  
  <blockquote>
    <p>Sorry, but there's some problem with your socket or the server is down</p>
  </blockquote>
  
  <p>If I navigate to the path the page is trying to access (<a href="http://localhost:8080/.../chat" rel="nofollow noreferrer">http://localhost:8080/.../chat</a>), I get the following message:</p>
  
  <blockquote>
    <p>org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler
    found. Make sure you define it inside META-INF/atmosphere.xml or
    annotate using @AtmosphereHandlerService</p>
  </blockquote>
  
  <p>I must be missing a file or setup configuration, but I can't seem to find where (the above message says the atmosphere.xml is missing, but this doesn't appear in the example). Any help would be appreciated.</p>