dcsimg
February 21, 2020
Hot Topics:

JRuby on Rails with Nine Lives: Running a JRuby on Rails Application on Tomcat

  • By Dominic Da Silva
  • Send Email »
  • More Articles »

Now, create your scaffold for your Guitar Ruby class that Rails will use to manage your guitars table. Run the following command:

jruby script/generate scaffold Guitar



Click here for a larger image.

Figure 14: Generating the Guitar class scaffold

Testing the Rails Application Using WEBrick

Now that you have everything you need to do CRUD operations on our guitars table, give your app a quick test run using Ruby's WEBrick server. You run the following command to start WEBrick and point your browser to http://localhost:3000/guitars:

jruby script/server



Click here for a larger image.

Figure 15: Running the railswartest app using the WEBrick server



Click here for a larger image.

Figure 16: The railswartest app running on the JRuby WEBrick server

Installing Tomcat

I assume you already have Apache Tomcat installed. If not, you can download it and uncompress it to your desired installation directory. I am using Tomcat version 5.5.17; it is installed to the /opt/tomcat directory.

Creating the WAR File and Deploying It to Tomcat

To create a WAR file of your railstestwar app, run the following command:

jruby -S rake war:standalone:create



Click here for a larger image.

Figure 17: Creating the railswartest WAR





Page 5 of 8



This article was originally published on July 31, 2007

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date