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

    Problem Using TomcatCometServlet

    williajd

      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.

        • 1. Problem Using TomcatCometServlet
          williajd

          After further investigation it appears that this could be a timing issue.

           

          There is an attempt to POST to the servlet before the QueueSession has been created for this session. It happens everytime the App.html page is loaded, but happens only once. Then the heartbeats start and seem to be OK.

           

          I will however have to make sure my application can handle it as it seems to interrupt the initialisation of the application.

          • 2. Problem Using TomcatCometServlet
            williajd

            I have worked out that the application is heartbeating OK but requests to services are not making it to the annotated classes.

             

            I'm seeing this in both the simple application and my more complex application.

             

            Help would be appreciated.....

            • 3. Problem Using TomcatCometServlet
              cbrock

              What version of Tomcat is this?

              • 4. Problem Using TomcatCometServlet
                williajd

                I'm running Tomcat (6.0.32) on Windows XP.

                • 5. Problem Using TomcatCometServlet
                  cbrock

                  Would you be willing to try your application with the latest Errai snapshots? Version 1.2.2-SNAPSHOT for both errai and errai-cdi.

                  • 6. Problem Using TomcatCometServlet
                    williajd

                    Hi Christopher,

                     

                    Thank you for the prompt replies. I will try and find the time to test against the snapshots.

                     

                    Please note, however, that the example I uploaded does not use CDI. It is a bare bones Errai Application. Were you able to see the problem when running the example I uploaded? If not, then maybe it is something to do with my Tomcat installation. I'd be happy to be proven wrong!

                     

                    Cheers

                     

                    James

                    • 7. Problem Using TomcatCometServlet
                      cbrock

                      I actually have reason to beleive you're encountering a real bug that we fixed.