title: AtmosphereFramework exception java.lang.IllegalStateException: Not supported
body: <p>I am using Atmosphere in my grails application. every thing is fine when running application from my IDE (IntelliJ Idea). but when I deploy it to tomcat (7.0) following exception raises:</p>
  
  <pre><code>2013-07-08 09:07:19,118 [ajp-nio-8009-exec-13] ERROR cpr.AtmosphereFramework  - AtmosphereFramework exception
  java.lang.IllegalStateException: Not supported.
      at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:594)
      at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:138)
      at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:104)
      at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.doService(Tomcat7Servlet30SupportWithWebSocket.java:65)
      at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:87)
      at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:61)
      at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1571)
      at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:176)
      at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:162)
      at com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>myservlet config in web.xml is:</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;description&gt;MeteorServlet&lt;/description&gt;
          &lt;servlet-name&gt;MeteorServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.grails.plugin.platform.events.push.GrailsMeteorServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;org.atmosphere.cpr.broadcaster.shareableThreadPool&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;org.atmosphere.cpr.broadcaster.maxProcessingThreads&lt;/param-name&gt;
              &lt;param-value&gt;20&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads&lt;/param-name&gt;
              &lt;param-value&gt;20&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;0&lt;/load-on-startup&gt;
          &lt;async-supported&gt;true&lt;/async-supported&gt;
      &lt;/servlet&gt;
  </code></pre>
  
  <p>usage is</p>
  
  <pre><code>var receivedOrders = new Array();
      var grailsEvents = new grails.Events("${rootPath}",
      {
          transport: 'sse',
          fallbackTransport: 'long-polling',
          timeout: 10000,
          onMessage: function(data){
              try{
                  if(data.responseBody.length &gt; 0){
                      var order = jQuery.parseJSON(data.responseBody).body;
                      if(order.id){
                          if (receivedOrders.indexOf(order.id) == -1) {
                          receivedOrders[receivedOrders.length] = order.id;
                          var url = "&lt;g:createLink controller="orderAdministration" action="orderNotification"/&gt;";
                          $.ajax({
                              type: "POST",
                              url: url,
                              data: { id: order.id }
                          }).done(function (response) {
                                      if (response != "0") {
                                          $.msgGrowl({
                                              type: 'info', sticky: true, 'title': '${message(code: 'order.notification.title')}', 'text': response, lifetime: 5000
                                          });
                                      }
                                  });
                          }
                      }
                  }
              } catch (e) {
                  // Atmosphere sends commented out data to WebKit based browsers
              }
          }
      });
  
      grailsEvents.on('order_event', function(data){});
  </code></pre>
  
  <p>it seems some thing is wrong with tomcat configuration. any idea?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have tested it. but does not work.</p>
  
  <p>the problem occured because I have provided options in grails.Events.
  by changing to this, exception solved. </p>
  
  <pre><code>var receivedOrders = new Array();
      var grailsEvents = new grails.Events("${rootPath}");
  
      function handleOrderEvent(data){
          try{
              if(data.id){
                  if (receivedOrders.indexOf(data.id) == -1) {
                      receivedOrders[receivedOrders.length] = data.id;
                      var url = "&lt;g:createLink controller="orderAdministration" action="orderNotification"/&gt;";
                      $.ajax({
                          type: "POST",
                          url: url,
                          data: { id: data.id }
                      }).done(function (response) {
                          if (response != "0") {
                              $.msgGrowl({
                                  type: 'info', sticky: true, 'title': '${message(code: 'order.notification.title')}', 'text': response, lifetime: 5000
                              });
                          }
                      });
                  }
              }
          }catch (e) {
          // Atmosphere sends commented out data to WebKit based browsers
          }
      }
  
      grailsEvents.on('order_event', handleOrderEvent, {transport:'long-polling', fallbackTransport:'polling'});
  </code></pre>
  
  <p>but still no event is propagated to client!</p>
  
  <p>I have an apache webserver in front of tomcat. events fired in services but not in javascript.</p>