7 Replies Latest reply on Mar 21, 2011 10:06 AM by Mike Brock

    Problem Using TomcatCometServlet

    James Williams Newbie

      Another question about Errai.

       

      The application's target environment is Tomcat 6.0.x. I'm able to run my application in hosted mode using the DefaultBlockingServlet or the JettyContinuationsServlet without any errors. If I deploy to Tomcat using the DefaultBlockingServlet the application runs but can hang sometimes with multiple users.

       

      Because of this I am trying to use the TomcatCometServlet instead. I have installed the AIO libraries and they appear to be working properly. Unfortunately when I open the application I get the following exception in the browser. Note that I turned on PRETTY styles to see where the error was in the javascript.

       

      receiver 'ClientBus' threw an exception

      Additional details:

      Field          Value

      ToSubject          ClientBus

      CommandType          Disconnect

      Reason          There is no queue associated with this session.

      com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'isRepeating' of null

      stack: TypeError: Cannot read property 'isRepeating' of null

          at $cancel_0 (http://localhost:8080/test/app/21D0326EBA4151ADD94938314F975026.cache.html:182:14)

          at $stop (http://localhost:8080/test/app/21D0326EBA4151ADD94938314F975026.cache.html:13224:68)

          at Object.callback_1 [as callback] (http://localhost:8080/test/app/21D0326EBA4151ADD94938314F975026.cache.html:13682:72)

          at Object.callback_0 [as callback] (http://localhost:8080/test/app/21D0326EBA4151ADD94938314F975026.cache.html:13510:88)

          at http://localhost:8080/test/app/21D0326EBA4151ADD94938314F975026.cache.html:13298:80

          at Object._publish (http://localhost:8080/test/app/js/pagebus.js:128:40)

          at Object._publish (http://localhost:8080/test/app/js/pagebus.js:104:26)

          at Object.publish (http://localhost:8080/test/app/js/pagebus.js:68:18)

          at [object Object].publish (http://localhost:8080/test/app/js/pagebus.js:235:38)

          at [object Object].store (http://localhost:8080/test/app/js/pagebus.js:294:25)

      arguments: isRepeating,

      type: non_object_property_load

        Unknown.$fillInStackTrace(JsArrayString.java:42)

        Unknown.$JavaScriptException(StackTraceCreator.java:366)

        Unknown.caught_0(Exceptions.java:29)

        Unknown.$cancel_0(CommandMessage.java:503)

        Unknown.$stop(ClientMessageBusImpl.java:535)

        Unknown.callback_1(ClientMessageBusImpl.java:731)

        Unknown.callback_0(ClientMessageBusImpl.java:225)

        Unknown.anonymous(JSONUtilCli.java:91)

        Unknown.$procIncomingPayload(JSONUtilCli.java:84)

        Unknown.onResponseReceived_0(ClientMessageBusImpl.java:790)

        Unknown.$fireOnResponseReceived(Request.java:287)

        Unknown.onReadyStateChange_0(RequestBuilder.java:393)

        Unknown.anonymous(XMLHttpRequest.java:258)

        Unknown.entry0(Impl.java:146)

        Unknown.anonymous(Impl.java:56)

       

      My project is quite complex using Seam modules and CDI integration so I went back and created a new simple project to see if it was something I had done. The error still happens so I thought I would post a complete description here and see if there is something I have missed.

       

      1) I create a new project with this command:

      mvn archetype:generate -DarchetypeGroupId=org.jboss.errai -DarchetypeArtifactId=sandbox-archetype -DarchetypeVersion=1.1-Final -DarchetypeRepository=https://repository.jboss.org/nexus/content/groups/public/

      2) cd into the new project directory and run:

      mvn gwt:run

      3) Once the development console comes up launch the default browser. This works as expected. The hello world message appears in the console.

      4) Change the web.xml file:

      <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>

      becomes

      <servlet-class>org.jboss.errai.bus.server.servlet.TomcatCometServlet</servlet-class>

      5) Kill the development console and enter the following:

      mvn clean package

      6) Deploy the generated war to tomcat webapps directory.

      7) start tomcat and hit the following url:

      http://localhost:8080/test/App.html, where test is the name of the copied war file.

       

      The same error still happens! The offending (generated) javascript looks like this:

      function $cancel_0(this$static){

        var stackIndex;

        $stack_0[stackIndex = ++$stackDepth_0] = $cancel_0;

        ($location_0[stackIndex] = 'Timer.java:' + '84' , this$static).isRepeating?($location_0[stackIndex] = 'Timer.java:' + '45' , ($location_0[stackIndex] = 'Timer.java:' + '45' , $wnd).clearInterval(($location_0[stackIndex] = 'Timer.java:' + '85' , this$static).timerId) , ($location_0[stackIndex] = 'com.google.gwt.dev.js.ast.JsProgram:' + '0' , undefined)):($location_0[stackIndex] = 'Timer.java:' + '49' , ($location_0[stackIndex] = 'Timer.java:' + '49' , $wnd).clearTimeout(($location_0[stackIndex] = 'Timer.java:' + '87' , this$static).timerId) , ($location_0[stackIndex] = 'com.google.gwt.dev.js.ast.JsProgram:' + '0' , undefined));

        $remove_9(($location_0[stackIndex] = 'Timer.java:' + '89' , timers), this$static);

        $stackDepth_0 = stackIndex - 1;

      }

       

      I'm running Tomcat (6.0.32) on Windows XP. I've attached the entire simple project.

       

      I'm going to see if I can work it out and will post a fix if I do. Any help in the meantime would be appreciated.