Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple comet application "org is not defined"
    text
    copied!<p>I am trying to update an old cometd javascript wrapper and test client (was 1.3.x) that I have to the newer comet 2.5.1 javascript implementation. I have all of the dependencies and the browser can find them all, yet I am getting errors in Firebug's console (see below) <img src="https://i.stack.imgur.com/S1b42.png" alt="Multiple errors about &quot;org&quot;"></p> <p>The head of my HTML is as below:</p> <pre><code>&lt;head&gt; &lt;title&gt;CometD Tester&lt;/title&gt; &lt;link rel="stylesheet" type="text/css"href="style/style.css" /&gt; &lt;script type="text/javascript" src="org/cometd/Cometd.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="org/cometd/AckExtension.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="org/cometd/ReloadExtension.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery/jquery-1.9.0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery/jquery.cookie.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery/jquery.cometd.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery/jquery.cometd-reload.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/myCometd.js"&gt;&lt;/script&gt; &lt;/head&gt; </code></pre> <p>All of these are found by the browser. Looking at <code>Cometd.js</code> I see the following:</p> <pre><code>org.cometd.Cometd = function(name) { .... } </code></pre> <p>So is that not defining org? Note that none of the errors in the Console are from <code>Cometd.js</code>. Otherwise I see no other definition of "org.cometd". I would really appreciate it if anyone can help me out. I am using Tomcat 7 and below is the dir structure:</p> <p><img src="https://i.stack.imgur.com/lS9ba.png" alt="Layout of the directories for the client app"></p> <p>Thanks.</p> <p><strong>UPDATE - Further testing</strong></p> <p>I reduced the header to:</p> <pre><code>&lt;head&gt; &lt;title&gt;CometD Tester&lt;/title&gt; &lt;link rel="stylesheet" type="text/css"href="style/style.css" /&gt; &lt;script type="text/javascript" src="org/cometd/Cometd.js"&gt;&lt;/script&gt; &lt;/head&gt; </code></pre> <p>And removed ALL JS from the index.html. The only JS now included is the Cometd.js from the comet.org. There is still the same error... coming from the very first line in that script:</p> <pre><code>org.cometd.Cometd = function(name) </code></pre> <p>Not sure what I have missed here.</p> <p><strong>EDIT - Add jquery.cometd-reload.js</strong> This is the contents of the file. It looks like it is "re-binding" functionality from the cometd library to use the jquery one instead (?). I'm not up to speed enough in JS to debug this (I'm a C++ dev really).</p> <pre><code>(function($) { function bind(org_cometd, cookie, ReloadExtension, cometd) { // Remap cometd COOKIE functions to jquery cookie functions // Avoid to set to undefined if the jquery cookie plugin is not present if (cookie) { org_cometd.COOKIE.set = cookie; org_cometd.COOKIE.get = cookie; } var result = new ReloadExtension(); cometd.registerExtension('reload', result); return result; } if (typeof define === 'function' &amp;&amp; define.amd) { define(['org/cometd', 'jquery.cookie', 'org/cometd/ReloadExtension', 'jquery.cometd'], bind); } else { bind(org.cometd, $.cookie, org.cometd.ReloadExtension, $.cometd); } })(jQuery); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload