apache/hadoop · error · Error

Bootstrap's JavaScript requires jQuery

Error message

Bootstrap's JavaScript requires jQuery

What it means

bootstrap.js (the Bootstrap 3.4.1 bundle shipped under hadoop-hdfs webapps/static) begins with a guard: if typeof jQuery === 'undefined' it throws Error("Bootstrap's JavaScript requires jQuery"). Bootstrap 3 plugins are jQuery plugins that attach to $.fn, so the library refuses to load when jQuery is not already defined on the page.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/bootstrap-3.4.1/js/bootstrap.js:8

/*!
 * Bootstrap v3.4.1 (https://getbootstrap.com/)
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under the MIT license
 */

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

+function ($) {
  'use strict';
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  }
}(jQuery);

/* ========================================================================
 * Bootstrap: transition.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

View on GitHub (pinned to 2add963021)

Solutions

  1. Include jQuery before bootstrap.js: <script src="/static/jquery..."> first, then bootstrap's js
  2. Open browser devtools Network tab and confirm the jQuery request is not 404 or blocked
  3. Make sure nothing calls jQuery.noConflict(true) and removes the global before bootstrap.js runs

Example fix

<!-- before -->
<script src="/static/bootstrap-3.4.1/js/bootstrap.js"></script>
<script src="/static/jquery-3.6.0.min.js"></script>

<!-- after -->
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/static/bootstrap-3.4.1/js/bootstrap.js"></script>
Defensive patterns

Strategy: validation

Validate before calling

if (typeof jQuery === 'undefined') {
  // load jQuery before bootstrap.js, e.g. document.write or a script loader
  var s = document.createElement('script');
  s.src = '/static/jquery-3.6.0.min.js';
  s.onload = function () { /* now safe to load bootstrap.js */ };
  document.head.appendChild(s);
}

Type guard

function jQueryLoaded() {
  return typeof window.jQuery !== 'undefined';
}

Prevention

When it happens

Trigger: Loading bootstrap.js before jquery.js in the page's script order, or jQuery failing to load entirely (404 on the /static/jquery*.js asset, blocked request, typo'd path) in an HDFS web UI or custom page that includes both.

Common situations: Custom JSP/HTML added to the HDFS web UI that lists scripts in the wrong order; air-gapped clusters where a CDN jQuery is blocked; pages refactored to load jQuery deferred/async while bootstrap.js still loads synchronously.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/89ee2b3e0393862d. Report an issue: GitHub.