Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Run a Rails Application with JRuby on Apache Tomcat

A practical guide to packaging Rails on JRuby as a WAR with Warbler, configuring JRuby-Rack, deploying to Apache Tomcat, sizing runtimes, validating the app, and fixing common compatibility failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The dependable external-server deployment path is to run Rails on JRuby, package the application as a Java WAR with Warbler, let JRuby-Rack translate Rack requests to the Servlet API, and deploy that WAR to Apache Tomcat. The details that determine whether it starts are version alignment, Bundler resolution, Rails environment settings, and deliberate JRuby runtime-pool sizing.

How the deployment fits together

This arrangement has three distinct layers:

  • JRuby runs the Ruby language and Rails application on the JVM.
  • Warbler packages the Rails or Rack application and its required files into a Java WAR archive. Its README describes it as “a gem to make a Java jar or war file out of any Ruby, Rails or Rack application.”
  • JRuby-Rack is the adapter between Rack/Rails and the Java Servlet environment. Its README describes it as a lightweight adapter that lets a Rack application run unmodified in a Java Servlet container.
  • Apache Tomcat supplies the external Servlet container, connectors, process lifecycle, and application deployment operations.

Tomcat does not execute a Rails directory directly. It receives the generated WAR, loads JRuby-Rack, and uses the servlet context parameters and packaged application to create Rails runtimes.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check compatibility before changing the application

Do not select versions independently. A JRuby-Rack release can be correct for one JRuby, Rack, Rails, and Servlet API combination and fail for another. The currently maintained project matrices in the supplied documentation give these reference ranges:

Reference component Compatibility stated by the project What you must verify
JRuby-Rack 1.2 JRuby 9.3–10.1; Java 8 or newer; Rails 5.0–8.0; Rack 2.2; Servlet API 3.0 That your Rails and Rack versions fit the row and that Tomcat exposes the required Servlet API level.
Warbler 2.1 JRuby 9.4–10.1; Java 8 or newer; JRuby-Rack 1.2–2.0; Rails 5.0–8.0 That the selected JRuby-Rack release is supported by both Warbler and your target container.
Java Java 8+ in both referenced matrices The exact Java runtime used by the Tomcat service, not only the one in your shell.
Servlet API Servlet API 3.0 is listed for the JRuby-Rack 1.2 row The Servlet level provided by the Tomcat installation and any deployment restrictions imposed by your organization.

These are compatibility-table ranges, not a promise that every combination inside them has identical behavior. Record the exact JRuby, Java, Rails, Rack, JRuby-Rack, Warbler, and Tomcat versions before you build. If a historical tutorial tells you to use a particular gem version, replace that advice with the current project matrix.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Prepare the Rails application

Confirm the runtime and bundle

Run the checks from the same JRuby installation that will build and run the WAR. Confirm that Bundler resolves a JRuby-compatible dependency set and that the rack gem is present in the application bundle. JRuby-Rack does not necessarily vendor Rack for you; a missing Rack gem can therefore appear only after deployment.

jruby --version
java -version
bundle platform
bundle check

The output should identify JRuby rather than a native Ruby interpreter, show the Java runtime intended for Tomcat, and report a complete bundle. Resolve dependency errors before packaging; a WAR built from an incomplete bundle will not become complete on the server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add Warbler to development tooling

Add Warbler to the application’s development dependencies so the build uses a Bundler-resolved version:

group :development do
  gem "warbler"
end

Run Bundler with JRuby, then invoke Warbler from the Rails root:

bundle install
bundle exec warble

Warbler detects Rails applications and defaults the Rails environment to production when it builds. Treat that default as a deployment choice, not as a substitute for explicitly configuring the servlet environment.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Generate and review Warbler configuration

Create the optional configuration file when you need to control packaging:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
bundle exec warble config

This generates config/warble.rb. Review it for the files, gems, public assets, and application settings that must be included in your deployment. Keep configuration changes in version control so a rebuild on another machine produces the same intended archive.

Configure Rails and JRuby-Rack for a servlet deployment

Set the Rails environment deliberately

JRuby-Rack’s Rails example uses a web.xml context parameter named rails.env. Set it to the environment you intend Tomcat to run; production is the usual choice for a production WAR:

<context-param>
  <param-name>rails.env</param-name>
  <param-value>production</param-value>
</context-param>

Do not assume a Rails default will override the servlet setting. The servlet context is the deployment boundary, so environment-specific database credentials, secret configuration, logging, caching, and asset behavior must be available to the Tomcat process.

Choose the JRuby runtime pool

JRuby-Rack creates and reuses JRuby runtimes inside the servlet container. Its Rails example exposes minimum and maximum runtime settings through servlet context parameters. Use the parameter names and syntax from the JRuby-Rack release you selected, then choose values based on concurrency and memory rather than copying an old example.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • For a thread-safe Rails application that is intentionally run with one JRuby runtime, set both pool bounds to 1.
  • If the application is not thread-safe or requires isolation, multiple runtimes can provide separation, but each runtime increases memory use and startup work.
  • Size the upper bound for the workload Tomcat must handle, while leaving headroom for the JVM, Rails objects, database connections, and other applications in the same process.
  • Keep the lower bound high enough to avoid an avoidable cold-start penalty, but not so high that every Tomcat restart allocates unnecessary runtimes.

Pool settings are servlet deployment settings. Changing Rails’ development or production mode does not automatically choose an appropriate JRuby runtime count.

Keep database, assets, and jobs deployment-aware

Before building, verify that the production bundle contains the database adapter and that the Tomcat process can read the production database configuration. Exercise the asset path used by the application after deployment; a WAR can start successfully while a missing or incorrectly packaged asset fails only when a browser requests it.

Background jobs need a separate operational decision. A servlet container handles web requests; it does not automatically make a Rails job worker durable. Run workers using the process model your application already supports, and make sure shutdown and restart procedures do not abandon in-flight work.

Build and inspect the WAR

  1. From the Rails application’s root, confirm that the intended JRuby and Java are active and that bundle check succeeds.
  2. Generate or update config/warble.rb if packaging needs customization.
  3. Build the archive with bundle exec warble. Warbler writes a WAR in the project directory unless your configuration changes the output location.
  4. Inspect the build with Warbler’s war:debug task when detection or packaging is uncertain:
bundle exec warble war:debug

Use the debug output to verify that Warbler recognized the framework, selected the expected gems, and included the application files required at runtime. If a gem is missing from the archive, fix the bundle or Warbler configuration and rebuild instead of copying files into the WAR by hand.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy the WAR to Apache Tomcat

  1. Install and configure the Tomcat instance with the Java runtime selected during compatibility planning.
  2. Place the generated WAR in the Tomcat application deployment area configured by your installation. Many installations use the instance’s webapps directory, but administrators may configure a different location.
  3. Start Tomcat, or reload the application if the instance is already running. Use the deployment name Tomcat derives from the WAR filename when constructing the application URL.
  4. Watch Tomcat’s startup and application logs from the first deployment. Look for dependency resolution, servlet initialization, Rails boot, database connection, and asset errors in that order.
  5. If the archive was rebuilt, replace the deployed artifact through your normal release procedure and perform a controlled reload or restart. Avoid mixing files from different WAR builds in one deployment directory.

The JRuby project’s server guidance identifies Tomcat as a standard Java server for WAR files produced by Warbler. Tomcat owns connector and process configuration; Rails and JRuby-Rack own application initialization inside that container.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Validate the running application

A successful Tomcat deployment message is not a complete health check. Test the application in the target environment in this order:

  • Health endpoint: request a lightweight endpoint that does not require a browser session and confirm the expected status and body.
  • Rails boot: load a route that exercises the framework, middleware, and templates.
  • Database connectivity: perform a read and, in a safe test environment, a controlled write followed by cleanup.
  • Assets: request CSS, JavaScript, images, and any fingerprinted production assets.
  • Concurrency: issue more than one request when the pool is configured above one and inspect logs for runtime acquisition or exhaustion.
  • Background processing: enqueue and complete a representative job using the separately managed worker.
  • Graceful shutdown: stop or reload Tomcat and confirm that requests finish according to your deployment policy and that the application can start again without stale locks or incomplete initialization.

There is no universal benchmark or test script supplied for this stack. Your health checks should reflect your routes, database, assets, job system, and shutdown policy.

External Tomcat, Trinidad, or another JRuby server?

Deployment choice How it works Best fit Trade-offs
External Tomcat plus WAR Warbler creates a WAR; JRuby-Rack runs the Rails application inside an independently managed Tomcat instance. Organizations that already standardize on Java application-server operations, connectors, logs, access control, and restart procedures. Requires careful servlet and gem compatibility work. Tomcat administrators own the container while application teams own Rails and packaging.
Trinidad Trinidad embeds Apache Tomcat and runs Rails/Rack from JRuby using a trinidad.yml or Ruby configuration. Self-contained processes and local development where an external application-server installation would add friction. Process, connector, and deployment concerns move into the Trinidad process and its configuration rather than an enterprise Tomcat installation.
Another standalone JRuby web server JRuby serves the Rack application directly through that server’s process model instead of a WAR deployed to Tomcat. Teams that do not need Servlet-container integration or Java application-server standardization. You give up the specific Tomcat deployment model and must evaluate that server’s JRuby, Rack, connector, monitoring, and lifecycle support separately.

Compare these options on six practical axes: Servlet API compatibility, ownership of process and connector configuration, Java integration requirements, packaging format, observability, and local-development ergonomics. External Tomcat is not inherently faster; the supplied project material provides no authoritative performance statistic for any of the choices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot failures by layer

The application will not boot because of JRuby-Rack versions

Use Bundler to pin a JRuby-Rack release supported by the selected JRuby, Rails, Rack, and Servlet API. Warbler explicitly warns that target web-server compatibility can require restricting the JRuby-Rack version. Compare the resolved bundle with the maintained compatibility table instead of trying random upgrades.

Rack 3 causes dependency or startup errors

Warbler documents failures when Rack 3 is paired with a JRuby-Rack release that does not support Rack 3. Upgrade JRuby-Rack to a release that supports your Rack line, or constrain Rack to a compatible 2.2 release when your Rails version permits that choice. Rebuild the WAR after changing the lockfile.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Rack is missing at runtime

Check the bundle and the WAR contents. JRuby-Rack does not necessarily vendor Rack, so ensure the rack gem is a dependency of the application and is packaged by Warbler. Run bundle exec warble war:debug before redeploying.

Warbler does not detect Rails or omits files

Generate config/warble.rb, inspect the framework-detection and packaged-gem output with war:debug, and verify that you ran the command from the Rails root under the intended JRuby. Packaging problems are usually easier to correct in configuration than after deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Tomcat reports a Servlet API mismatch

Reconcile the Servlet level provided by Tomcat with the JRuby-Rack series selected in your bundle. A WAR can be structurally valid and still fail during servlet initialization when those APIs do not match. Change the container or the JRuby-Rack line as a coordinated version decision.

The application starts but requests fail

  • Confirm that rails.env is set to the intended environment in the servlet context.
  • Check that production database credentials and secrets are visible to the Tomcat service account.
  • Inspect asset requests separately from HTML routes.
  • Review runtime-pool bounds if requests block or fail under concurrency.
  • Check Tomcat and application logs together so servlet initialization errors are not mistaken for Rails routing errors.

Upgrade and release discipline

Keep the JRuby, Java, Rails, Rack, JRuby-Rack, Warbler, and Tomcat versions recorded as one tested deployment set. When one component changes, re-check the relevant project matrix, regenerate the lockfile under JRuby, rebuild the WAR, run the health and database checks, and test a controlled Tomcat restart. This prevents a seemingly harmless Rack or Java update from becoming a servlet-bridge failure in production.

The key operational boundary is simple: Warbler determines what is inside the archive, JRuby-Rack determines how Rack runs inside a servlet container, and Tomcat determines how that archive is hosted. Treat all three as one compatibility and release unit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.