<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2008-08-12T00:15:42Z</created-at>
  <description>Added note that GoldSpike is no longer recommended.</description>
  <id type="integer">127</id>
  <name>Goldspike</name>
  <number type="integer">10</number>
  <person-id type="integer">7</person-id>
  <text>[[Home|&amp;raquo; JRuby Project Wiki Home Page]] &amp;nbsp; &amp;nbsp; [[JRubyOnRails|&amp;raquo; JRuby on Rails]
&lt;h1&gt;GoldSpike&lt;/h1&gt;
'''Note: GoldSpike is being discontinued. Use &lt;a href=&quot;{{project warbler page Home}}&quot;&gt;Warbler&lt;/a&gt; instead of GoldSpike for packaging JRuby on Rails applications into WAR files.'''

Java web applications are typically packaged as WAR files in preparation for distribution and deployment to Java EE servers. It is useful to be able to package Ruby on Rails applications in a similar form, to enable seamless deployment to Java servers. This is what GoldSpike does.

__TOC__

== Creating a WAR of a Rails application ==

=== Warbler ===
See &lt;a href=&quot;{{project warbler page Home}}&quot;&gt;Warbler&lt;/a&gt; for our currently recommended way to package your Rails applications as a &lt;tt&gt;.war&lt;/tt&gt; file for deployment to a Java app server.

See also [[Jruby on Rails on Tomcat]] (Warbler related info).

''Note this section will be expanded in the near future.''

=== GoldSpike Rake Plugin ===
First, install the plugin:
  script/plugin install http://jruby-extras.rubyforge.org/svn/trunk/rails-integration/plugins/goldspike

'''Note:''' The script above doesn't work on JRuby under Windows XP. You'll need to install the [[Running Rails with ActiveRecord-JDBC|ActiveRecord-JDBC]] gem before you can use the rake-tasks below. You install it with the command:
 gem install activerecord-jdbc-adapter --no-rdoc --no-ri

Make sure that the plugin is installed, and run the following command:
 rake war:standalone:create

If you want to run a lot of JRuby web applications on an application server, it might be more efficient to install JRuby on your server's classpath and create a war containing just the application code:
 rake war:shared:create

Try out your application as a web archive using Jetty:
 rake war:standalone:run

== Building GoldSpike from source ==

Check out the source once:
* svn checkout svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration
* cd rails-integration
* set GEM_HOME to point to your gem repository, so that the tests can be run (typically something like &lt;jruby home&gt;/lib/ruby/gems/1.8) (use &quot;/&quot; instead of &quot;\&quot; on Windows)
* mvn install

=== Development Environment ===

==== Eclipse ====
The following command will download all the required jar files and create the Eclipse project for you:
 mvn eclipse:eclipse

After this you need to set the M2_REPO variable within Eclipse to point to your local Maven repository. This is typically at &lt;tt&gt;~/.m2/repository&lt;/tt&gt;.

==== NetBeans ====
??? 


==== IntelliJ IDEA ====
The following command will download all the required jar files and create the project for you:
 mvn idea:idea 

Alternatively, you can open the pom directly on newer versions of IDEA, which will automatically convert it into a project.

=== How to Debug Problems ===

== Frequently Asked Questions ==

=== Connecting to a database ===
To enable ActiveRecord you'll need to specify a database connection and package appropriate JDBC drivers.

Adding the JDBC driver is done by adding library dependencies into &lt;tt&gt;config/war.rb&lt;/tt&gt;. Create it if it doesn't exist.

For example, the MySQL driver can be included in the WAR with the following line:
 maven_library 'mysql', 'mysql-connector-java', '5.0.4'

Next, configure &lt;tt&gt;database.yml&lt;/tt&gt; to enable the use of &lt;tt&gt;ActiveRecord-JDBC&lt;/tt&gt; as the ActiveRecord database driver. 

'''Note:''' At present WAR files are set to &lt;b&gt;production by default&lt;/b&gt;.

Using our MySQL example again, this becomes:
&lt;pre&gt;
production:
  adapter: jdbc
  driver: com.mysql.jdbc.Driver
  url: jdbc:mysql://localhost/sample_production
  username: root
  password:
  host: localhost
&lt;/pre&gt;

Update &lt;tt&gt;config/environment.rb&lt;/tt&gt;.  See step '9' of [[Running Rails with ActiveRecord-JDBC]].

Now when you use the web application, it should use JDBC drivers from Java to connect to the database.

=== Using a connection from a pool via JNDI ===

Rails-Integration comes with rake tasks to create a war file for the rails app and configure a [http://jetty.mortbay.org jetty]
web server. To configure JNDI support, the following changes are required to be done...

'''1. Add the data source configuration to the &lt;tt&gt;jetty.xml&lt;/tt&gt; file.'''

'''Note:''' Every time you run the rake task - war:standalone:run, the &lt;tt&gt;jetty.xml&lt;/tt&gt; is recreated. Therefore, I suggest that you modify the rails-integration war plugin library, called &lt;tt&gt;run.rb&lt;/tt&gt; and add the entries below in the appropriate place.

For instance, for Oracle data source:

    &amp;lt;new id=&quot;MyApp1&quot; class=&quot;org.mortbay.jetty.plus.naming.Resource&quot;&amp;gt;
    &amp;lt;arg&amp;gt;jdbc/MyApp&amp;lt;/arg&amp;gt;
    &amp;lt;arg&amp;gt;
    &amp;lt;new class=&quot;oracle.jdbc.pool.OracleConnectionPoolDataSource&quot;&amp;gt;
    &amp;lt;set name=&quot;URL&quot;&amp;gt;jdbc:oracle:thin:@192.168.2.23:1521:swami&amp;lt;/set&amp;gt;
    &amp;lt;set name=&quot;User&quot;&amp;gt;myapp&amp;lt;/set&amp;gt;
    &amp;lt;set name=&quot;Password&quot;&amp;gt;myapp&amp;lt;/set&amp;gt;
    &amp;lt;/new&amp;gt;
    &amp;lt;/arg&amp;gt;
    &amp;lt;/new&amp;gt;
 
For the full list of configuration details for various databases, see [http://docs.codehaus.org/display/JETTY/DataSource+Examples Jetty DataSource+Examples].

'''Note:''' As stated in the Jetty documentation, the above entries can be updated in &lt;tt&gt;jetty-env.xml&lt;/tt&gt; or &lt;tt&gt;jetty-web.xml&lt;/tt&gt; as well. The scope of this configuration depends on where you put this configuration information.

'''2. Now, search for the following section in your &lt;tt&gt;jetty.xml&lt;/tt&gt; (or the &lt;tt&gt;run.rb&lt;/tt&gt; file):'''
    &amp;lt;New class=&quot;org.mortbay.jetty.webapp.WebAppContext&quot;&amp;gt;

Add the following entries after the two &amp;lt;Arg&amp;gt; entries:
    &amp;lt;Set name=&quot;ConfigurationClasses&quot;&amp;gt;
    &amp;lt;Array id=&quot;plusConfig&quot; type=&quot;java.lang.String&quot;&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.WebInfConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.plus.webapp.EnvConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.plus.webapp.Configuration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.JettyWebXmlConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.TagLibConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;/Array&amp;gt;
    &amp;lt;/Set&amp;gt;

'''3. Specify the JNDI Logical Name for the web application.'''

Add the following entries in your &lt;tt&gt;web.xml&lt;/tt&gt; under WEB-INF folder of your war file. 

'''Note:''' Every time you run the rake task - war:standalone:run, web.xml is recreated.  Therefore, I suggest that you modify the rails-integration war plugin library &lt;tt&gt;create_war.rb&lt;/tt&gt; and add the entries below in the appropriate place.
    &amp;lt;resource-ref&amp;gt;
    &amp;lt;description&amp;gt;My DataSource Reference&amp;lt;/description&amp;gt;
    &amp;lt;res-ref-name&amp;gt;jdbc/MyApp&amp;lt;/res-ref-name&amp;gt;
    &amp;lt;res-type&amp;gt;javax.sql.DataSource&amp;lt;/res-type&amp;gt;
    &amp;lt;res-auth&amp;gt;Container&amp;lt;/res-auth&amp;gt;
    &amp;lt;/resource-ref&amp;gt;

'''Note:''' In the trunk version, the above entries are already added.  All you have to do is setup the JNDI name in the property &lt;tt&gt;datasource_jndi_name&lt;/tt&gt; inside &lt;tt&gt;war_config.rb&lt;/tt&gt;.

'''4. To add JNDI support, Jetty requires two more libraries: Jetty-Naming and Jetty-Plus.'''

The best way to do this is to modify the rails-integration war plugin library &lt;tt&gt;war_config.rb&lt;/tt&gt;. Search for &lt;tt&gt;add_jetty_library&lt;/tt&gt; and append the following lines telling the war_config to download the two libraries as well:
    add_jetty_library(maven_library('org.mortbay.jetty', 'jetty-plus', '6.1.1'))
    add_jetty_library(maven_library('org.mortbay.jetty', 'jetty-naming', '6.1.1'))

'''5. Modify your &lt;tt&gt;database.yml&lt;/tt&gt; to use JNDI.'''
    production:
      adapter: jdbc
      jndi: java:comp/env/jdbc/MyApp
      driver: oracle

Thats it! Your rails web application is ready to run with JNDI Data source.

=== How do I use a specific JRuby release? ===
Add the following line to &lt;tt&gt;config/war.rb&lt;/tt&gt;
 maven_library 'org.jruby', 'jruby-complete', '0.9.9-SNAPSHOT'

=== Which version of Rails is used? ===
If RAILS_GEM_VERSION is set in &lt;tt&gt;environment.rb&lt;/tt&gt;, this will be used. Otherwise, the latest installed release of Ruby on Rails is used.

However, you might want to manually specify a version of Rails to use. This can be done by adding a gem dependency to &lt;tt&gt;config/war.rb&lt;/tt&gt;, such as:
 add_gem 'rails', '= 1.2.3'

=== Can I use servlet filters? ===
Yes you can. There is an example on how to do this on the [[CAS filter]] page.

=== How do you add JAR files to the resulting webapp? ===
Put them under &lt;tt&gt;lib/java&lt;/tt&gt; (create that directory if needed), and they'll propagate to the resulting web application.  

'''Note:''' I had to add a maven_library directive to my &lt;tt&gt;config/war.rb&lt;/tt&gt; to make this work. In GoldSpike 1.3, &lt;tt&gt;include_library(name,version)&lt;/tt&gt; in &lt;tt&gt;config/war.rb&lt;/tt&gt; is supposed to provide the ability to add Java libraries from either &lt;tt&gt;lib/java&lt;/tt&gt; or &lt;tt&gt;JRUBY_HOME/lib&lt;/tt&gt;, but the functionality has been broken for a while. A patch is available here:&lt;br/&gt;
http://rubyforge.org/tracker/index.php?func=detail&amp;aid=13963&amp;group_id=2014&amp;atid=7859

=== Which Java EE servers can I use ? ===
GoldSpike has been tested on:
* [http://glassfish.dev.java.net GlassFish]
* [http://jetty.mortbay.org/ Jetty]
* [http://tomcat.apache.org/ Tomcat]
* [http://www.bea.com/weblogic/ WebLogic]
* [http://www.ibm.com/developerworks/websphere/techjournal/0801_shillington/0801_shillington.html WebSphere]

=== How do I add dependent gems to the war? ===
Use 'add_gem' in war.rb.  For example:
 add_gem 'rmagick4j', '= 0.3.3'

=== How do I configure the number of requests GoldSpike can handle? ===
The number of simultaneous requests GoldSpike can process is based on the number of JRuby runtimes it creates.

Once GoldSpike has been run, it will create &lt;tt&gt;WEB-INF/web.xml&lt;/tt&gt; under your Rails application.
The following &lt;tt&gt;context-params&lt;/tt&gt; in &lt;tt&gt;web.xml&lt;/tt&gt; can be used to configure GoldSpike:

Maximum number of runtimes:
 jruby.pool.maxActive (defaults to 4)
Minimum number of runtimes:  
 jruby.pool.minIdle (defaults to 2)
Initial number of runtimes:
 jruby.pool.initialSize (defaults to jruby.pool.minIdle)
How often in milliseconds to check if more runtimes are needed:
 jruby.pool.checkInterval (defaults to 1000)

=== What should I do? I get &quot;Could not load Rails. See the logs for more details.&quot; error message. ===
This means that an exception was thrown while GoldSpike attempted to initialize the Rails application. This can be caused by a number of problems, for example:
* Failure to connect to the database
* Missing gems from the war
* Missing required jars which are loaded from &lt;tt&gt;environment.rb&lt;/tt&gt;

The best way to go about debugging this is to check the container log file. It should show the message and trace for the exception that was encountered.

=== How do I avoid bundling files such as .svn, .DS_Store, etc. into the WAR file? ===
I would LOVE to find the &quot;proper&quot; answer to this. I tried adding the following to &lt;tt&gt;war.rb&lt;/tt&gt;, but it only caused an exclusion at the top level, possibly because the file list that finally gets passed to the &lt;tt&gt;jar&lt;/tt&gt; command is only a list of the top-level files and directories:
 exclude_files File.join(&quot;.&quot;,&quot;**&quot;,&quot;.svn&quot;)

I ended up having to hack the GoldSpike code to run the following zip command immediately after the WAR file was built (in &lt;tt&gt;packer.rb&lt;/tt&gt;), which removes the designated files from the jar manually, throughout the ENTIRE jar file:
 zip -q -d #{os_target_file} \*.svn/\* \*.DS_Store

*os_target_file is the .jar filename
* .DS_Store is the OS X directory metadata file. 
* Backslashes are significant and necessary: See the zip man page!

I can't think of a circumstance when you wouldn't want to exclude these files from a WAR, so I didn't make it an option. Works great.

=== web.xml Notes ===

''After running warbler and looking at the resulting web.xml I was able to infer the following - please add or correct. Thx''

Within your web.xml you can set the following to tailor the WAR structure to your liking. Set inside &amp;lt;web-app&amp;gt; like:

&lt;pre&gt;
 &lt;context-param&gt;
 	&lt;param-name&gt;jruby.standalone&lt;/param-name&gt;
 	&lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/context-param&gt;
&lt;/pre&gt;

 jruby.standalone - true/false (what does this do?)
 jruby.session_store - &quot;db&quot;
 jruby.home
 jruby.pool.maxActive - 4
 jruby.pool.minIdle - 2
 jruby.pool.checkInterval - 1000 (ms)
 jruby.pool.maxWait - 30000 (ms)
 
 rails.root - path to rails app within the war file / webapp dir
 rails.env  - development|test|production
 
 files.root - absolute path to public files within the war file / webapp dir
 files.default - servlet id to use if a file cannot be found
 files.prefix - prefix added to static files
 files.welcome -

As with Rails, if a static file exists it will be served, otherwise it will try to dispatch via Rails.

Static file requests are (can be) serviced via &lt;tt&gt;org.jruby.webapp.FileServlet&lt;/tt&gt;.

Rails requests are serviced via &lt;tt&gt;org.jruby.webapp.RailsServlet&lt;/tt&gt;.

You should map / through the FileServlet
&lt;pre&gt;
 &lt;servlet-mapping&gt;
 	&lt;servlet-name&gt;files&lt;/servlet-name&gt;
 	&lt;url-pattern&gt;/&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
&lt;/pre&gt;

Additionally, System Properties you can set:

 jruby.objectspace.enabled
 gem.path
 gem.home

== More Information ==
* [http://blogs.sun.com/arungupta/entry/rails_and_java_ee_integration Rails and Java EE integration - Servlet co-bundled and invoked from Rails app] (Arun Gupta)
* [http://rubyforge.org/mail/?group_id=2014 RubyForge jruby-extras-devel Archives]

== Release roadmap ==

=== 1.5 - January 08 ===
* JRuby 1.1 support
* Rails 2.0 support
* Deprecate plugin, recommend the use of Warbler
* Bug 16108 - HttpOutput flush doesn't send headers - Patch by Matt Burke

=== 1.4 - December 07 ===
* Allow FileServlet to work even if activation.jar is not present at runtime
* Make rails.root param assume it's relative to the webapp
* Make pom download and install rails if necessary
* Added periodical task scheduler

=== 1.3 - August 07 ===
* Update to JRuby 1.0.1
* Support for WebLogic (tested with 9.2)
* Fix PUT, DELETE, etc requests not being passed on to RailsServlet.
* Add support for HEAD requests to FileServlet.
* Fix for a deadlock situation
* Add support for adding arbitrary files to WEB-INF, also looking at timestamps and so on to not add unnecessarily.
* Spring plugin
* Support for caching, by Li Xiao.
* Drop support for preparsing the syntax tree
* Don't add AR-JDBC or Rails gems if they're already added to vendor. By Michael Schubert.
* Servlet configuration templates are now created by a generator. By Bryan Liles.
* Support staggered start up of background tasks
* Make the servlet context directly available to Rails applications as $servlet_context
* Added RailsTaskServlet that makes it possible to run other Rails tasks such as for example ActiveMessaging
* Moved all runtime pool management out into a listener, for proper lifecycle management
* Added support for rails page caching
* Make system environment variables available at request time
* Running an embedded Jetty will now use RAILS_ENV (with a default of 'development') as the rails environment
* Assemble web application in place rather than using tmp/war
* MIT license
* Changed File.install to File.copy to improve performance
* Fix gem install courtesy Jeffrey Damick
* FileServlet can serve directly from an absolute paths

=== 1.2 - May 07 ===
* Bug 9711 - Tomcat 4 support
* Bug 10265 - Http session store
* Tests work with JDK 1.4

=== 1.1.1 - April 23, 2007 ===
* Bug 9321 - Better performance / Glassfish support (no runtime installation)
* Bug 9654 - JDK 1.4 support
* Enhancement 9999 - Support JNDI datasources
* Enhancement 10068 - Edge rails support

* Bug 9320 - NullpointerException in AbstractRailsServlet
* Bug 9394 - Allow deployment to root
* Bug 9419 - Ensure that ARGV is always available
* Enhancement 9710 - add_gem for config file
* Bug 9722 - Allow both symbols and strings for session keys
* Enhancement 10069 - Extra excludes paths
* Bug 10190 - java_library creates corrupt jar-files on windows
* Bug 10265 - fix marshalling issue with http servlet session store
</text>
  <text-as-html>&lt;p&gt;&lt;a href='&lt;?url_for_page Home?&gt;' class='internal'&gt;&amp;raquo; JRuby Project Wiki Home Page&lt;/a&gt; &amp;nbsp; &amp;nbsp; &lt;a href='&lt;?url_for_page JRubyOnRails?&gt;' class='internal'&gt;&amp;raquo; JRuby on Rails]&lt;/a&gt;&lt;h1&gt;GoldSpike&lt;/h1&gt;&lt;b&gt;Note: GoldSpike is being discontinued. Use &lt;a href=&quot;&lt;?url_for_resource project warbler page Home?&gt;&quot;&gt;Warbler&lt;/a&gt; instead of GoldSpike for packaging JRuby on Rails applications into WAR files.&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;Java web applications are typically packaged as WAR files in preparation for distribution and deployment to Java EE servers. It is useful to be able to package Ruby on Rails applications in a similar form, to enable seamless deployment to Java servers. This is what GoldSpike does.

&lt;/p&gt;&lt;div id='toc' class='toc'&gt;
           &lt;div id='toctitle' class='toc-title'&gt;
             &lt;span&gt;Contents&lt;/span&gt;
           &lt;/div&gt;
           &lt;div id='toccontents' class='toc-contents'&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;1 &lt;a href='#Creating_a_WAR_of_a_Rails_application'&gt; Creating a WAR of a Rails application &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;1.1 &lt;a href='#Warbler'&gt; Warbler &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;1.2 &lt;a href='#GoldSpike_Rake_Plugin'&gt; GoldSpike Rake Plugin &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;2 &lt;a href='#Building_GoldSpike_from_source'&gt; Building GoldSpike from source &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;2.1 &lt;a href='#Development_Environment'&gt; Development Environment &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;2.1.1 &lt;a href='#Eclipse'&gt; Eclipse &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2.1.2 &lt;a href='#NetBeans'&gt; NetBeans &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2.1.3 &lt;a href='#IntelliJ_IDEA'&gt; IntelliJ IDEA &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;2.2 &lt;a href='#How_to_Debug_Problems'&gt; How to Debug Problems &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;3 &lt;a href='#Frequently_Asked_Questions'&gt; Frequently Asked Questions &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;3.1 &lt;a href='#Connecting_to_a_database'&gt; Connecting to a database &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.2 &lt;a href='#Using_a_connection_from_a_pool_via_JNDI'&gt; Using a connection from a pool via JNDI &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.3 &lt;a href='#How_do_I_use_a_specific_JRuby_release?'&gt; How do I use a specific JRuby release? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.4 &lt;a href='#Which_version_of_Rails_is_used?'&gt; Which version of Rails is used? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.5 &lt;a href='#Can_I_use_servlet_filters?'&gt; Can I use servlet filters? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.6 &lt;a href='#How_do_you_add_JAR_files_to_the_resulting_webapp?'&gt; How do you add JAR files to the resulting webapp? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.7 &lt;a href='#Which_Java_EE_servers_can_I_use_?'&gt; Which Java EE servers can I use ? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.8 &lt;a href='#How_do_I_add_dependent_gems_to_the_war?'&gt; How do I add dependent gems to the war? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.9 &lt;a href='#How_do_I_configure_the_number_of_requests_GoldSpike_can_handle?'&gt; How do I configure the number of requests GoldSpike can handle? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.10 &lt;a href='#What_should_I_do?_I_get_&amp;quot;Could_not_load_Rails._See_the_logs_for_more_details.&amp;quot;_error_message.'&gt; What should I do? I get &amp;quot;Could not load Rails. See the logs for more details.&amp;quot; error message. &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.11 &lt;a href='#How_do_I_avoid_bundling_files_such_as_.svn,_.DS_Store,_etc._into_the_WAR_file?'&gt; How do I avoid bundling files such as .svn, .DS_Store, etc. into the WAR file? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3.12 &lt;a href='#web.xml_Notes'&gt; web.xml Notes &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;4 &lt;a href='#More_Information'&gt; More Information &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5 &lt;a href='#Release_roadmap'&gt; Release roadmap &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;5.1 &lt;a href='#1.5_-_January_08'&gt; 1.5 - January 08 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5.2 &lt;a href='#1.4_-_December_07'&gt; 1.4 - December 07 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5.3 &lt;a href='#1.3_-_August_07'&gt; 1.3 - August 07 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5.4 &lt;a href='#1.2_-_May_07'&gt; 1.2 - May 07 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5.5 &lt;a href='#1.1.1_-_April_23,_2007'&gt; 1.1.1 - April 23, 2007 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/div&gt;
         &lt;/div&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Creating_a_WAR_of_a_Rails_application'&gt;&lt;/a&gt; Creating a WAR of a Rails application &lt;/h2&gt;
&lt;h3&gt;&lt;a name='Warbler'&gt;&lt;/a&gt; Warbler &lt;/h3&gt;
&lt;p&gt;See &lt;a href=&quot;&lt;?url_for_resource project warbler page Home?&gt;&quot;&gt;Warbler&lt;/a&gt; for our currently recommended way to package your Rails applications as a &lt;tt&gt;.war&lt;/tt&gt; file for deployment to a Java app server.

&lt;/p&gt;&lt;p&gt;See also &lt;a href='&lt;?url_for_page Jruby on Rails on Tomcat?&gt;' class='internal'&gt;Jruby on Rails on Tomcat&lt;/a&gt; (Warbler related info).

&lt;/p&gt;&lt;p&gt;&lt;i&gt;Note this section will be expanded in the near future.&lt;/i&gt;

&lt;/p&gt;&lt;h3&gt;&lt;a name='GoldSpike_Rake_Plugin'&gt;&lt;/a&gt; GoldSpike Rake Plugin &lt;/h3&gt;
&lt;p&gt;First, install the plugin:
&lt;/p&gt;&lt;pre&gt;  script/plugin install &lt;a class='external' href=&quot;http://jruby-extras.rubyforge.org/svn/trunk/rails-integration/plugins/goldspike&quot;&gt;http://jruby-extras.rubyforge.org/svn/trunk/rails-integration/plugins/goldspike&lt;/a&gt;
&lt;/pre&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The script above doesn't work on JRuby under Windows XP. You'll need to install the &lt;a href='&lt;?url_for_page Running Rails with ActiveRecord-JDBC?&gt;' class='internal'&gt;ActiveRecord-JDBC&lt;/a&gt; gem before you can use the rake-tasks below. You install it with the command:
&lt;/p&gt;&lt;pre&gt; gem install activerecord-jdbc-adapter --no-rdoc --no-ri
&lt;/pre&gt;&lt;p&gt;
Make sure that the plugin is installed, and run the following command:
&lt;/p&gt;&lt;pre&gt; rake war:standalone:create
&lt;/pre&gt;&lt;p&gt;
If you want to run a lot of JRuby web applications on an application server, it might be more efficient to install JRuby on your server's classpath and create a war containing just the application code:
&lt;/p&gt;&lt;pre&gt; rake war:shared:create
&lt;/pre&gt;&lt;p&gt;
Try out your application as a web archive using Jetty:
&lt;/p&gt;&lt;pre&gt; rake war:standalone:run
&lt;/pre&gt;&lt;h2&gt;&lt;a name='Building_GoldSpike_from_source'&gt;&lt;/a&gt; Building GoldSpike from source &lt;/h2&gt;
&lt;p&gt;
Check out the source once:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; svn checkout svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration
&lt;/li&gt;&lt;li&gt; cd rails-integration
&lt;/li&gt;&lt;li&gt; set GEM_HOME to point to your gem repository, so that the tests can be run (typically something like &amp;lt;jruby home&amp;gt;/lib/ruby/gems/1.8) (use &amp;quot;/&amp;quot; instead of &amp;quot;\&amp;quot; on Windows)
&lt;/li&gt;&lt;li&gt; mvn install
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='Development_Environment'&gt;&lt;/a&gt; Development Environment &lt;/h3&gt;
&lt;h4&gt;&lt;a name='Eclipse'&gt;&lt;/a&gt; Eclipse &lt;/h4&gt;
&lt;p&gt;The following command will download all the required jar files and create the Eclipse project for you:
&lt;/p&gt;&lt;pre&gt; mvn eclipse:eclipse
&lt;/pre&gt;&lt;p&gt;
After this you need to set the M2_REPO variable within Eclipse to point to your local Maven repository. This is typically at &lt;tt&gt;~/.m2/repository&lt;/tt&gt;.

&lt;/p&gt;&lt;h4&gt;&lt;a name='NetBeans'&gt;&lt;/a&gt; NetBeans &lt;/h4&gt;
&lt;p&gt;??? 

&lt;/p&gt;&lt;h4&gt;&lt;a name='IntelliJ_IDEA'&gt;&lt;/a&gt; IntelliJ IDEA &lt;/h4&gt;
&lt;p&gt;The following command will download all the required jar files and create the project for you:
&lt;/p&gt;&lt;pre&gt; mvn idea:idea 
&lt;/pre&gt;&lt;p&gt;
Alternatively, you can open the pom directly on newer versions of IDEA, which will automatically convert it into a project.

&lt;/p&gt;&lt;h3&gt;&lt;a name='How_to_Debug_Problems'&gt;&lt;/a&gt; How to Debug Problems &lt;/h3&gt;
&lt;h2&gt;&lt;a name='Frequently_Asked_Questions'&gt;&lt;/a&gt; Frequently Asked Questions &lt;/h2&gt;
&lt;h3&gt;&lt;a name='Connecting_to_a_database'&gt;&lt;/a&gt; Connecting to a database &lt;/h3&gt;
&lt;p&gt;To enable ActiveRecord you'll need to specify a database connection and package appropriate JDBC drivers.

&lt;/p&gt;&lt;p&gt;Adding the JDBC driver is done by adding library dependencies into &lt;tt&gt;config/war.rb&lt;/tt&gt;. Create it if it doesn't exist.

&lt;/p&gt;&lt;p&gt;For example, the MySQL driver can be included in the WAR with the following line:
&lt;/p&gt;&lt;pre&gt; maven_library 'mysql', 'mysql-connector-java', '5.0.4'
&lt;/pre&gt;&lt;p&gt;
Next, configure &lt;tt&gt;database.yml&lt;/tt&gt; to enable the use of &lt;tt&gt;ActiveRecord-JDBC&lt;/tt&gt; as the ActiveRecord database driver. 

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; At present WAR files are set to &lt;b&gt;production by default&lt;/b&gt;.

&lt;/p&gt;&lt;p&gt;Using our MySQL example again, this becomes:
&lt;pre&gt;
production:
  adapter: jdbc
  driver: com.mysql.jdbc.Driver
  url: jdbc:mysql://localhost/sample_production
  username: root
  password:
  host: localhost
&lt;/pre&gt;

&lt;/p&gt;&lt;p&gt;Update &lt;tt&gt;config/environment.rb&lt;/tt&gt;.  See step '9' of &lt;a href='&lt;?url_for_page Running Rails with ActiveRecord-JDBC?&gt;' class='internal'&gt;Running Rails with ActiveRecord-JDBC&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;Now when you use the web application, it should use JDBC drivers from Java to connect to the database.

&lt;/p&gt;&lt;h3&gt;&lt;a name='Using_a_connection_from_a_pool_via_JNDI'&gt;&lt;/a&gt; Using a connection from a pool via JNDI &lt;/h3&gt;
&lt;p&gt;
Rails-Integration comes with rake tasks to create a war file for the rails app and configure a &lt;a class='external' href=&quot;http://jetty.mortbay.org&quot;&gt;jetty&lt;/a&gt;
web server. To configure JNDI support, the following changes are required to be done...

&lt;/p&gt;&lt;p&gt;&lt;b&gt;1. Add the data source configuration to the &lt;tt&gt;jetty.xml&lt;/tt&gt; file.&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Every time you run the rake task - war:standalone:run, the &lt;tt&gt;jetty.xml&lt;/tt&gt; is recreated. Therefore, I suggest that you modify the rails-integration war plugin library, called &lt;tt&gt;run.rb&lt;/tt&gt; and add the entries below in the appropriate place.

&lt;/p&gt;&lt;p&gt;For instance, for Oracle data source:

&lt;/p&gt;&lt;pre&gt;    &amp;lt;new id=&amp;quot;MyApp1&amp;quot; class=&amp;quot;org.mortbay.jetty.plus.naming.Resource&amp;quot;&amp;gt;
    &amp;lt;arg&amp;gt;jdbc/MyApp&amp;lt;/arg&amp;gt;
    &amp;lt;arg&amp;gt;
    &amp;lt;new class=&amp;quot;oracle.jdbc.pool.OracleConnectionPoolDataSource&amp;quot;&amp;gt;
    &amp;lt;set name=&amp;quot;URL&amp;quot;&amp;gt;jdbc:oracle:thin:@192.168.2.23:1521:swami&amp;lt;/set&amp;gt;
    &amp;lt;set name=&amp;quot;User&amp;quot;&amp;gt;myapp&amp;lt;/set&amp;gt;
    &amp;lt;set name=&amp;quot;Password&amp;quot;&amp;gt;myapp&amp;lt;/set&amp;gt;
    &amp;lt;/new&amp;gt;
    &amp;lt;/arg&amp;gt;
    &amp;lt;/new&amp;gt;
 
&lt;/pre&gt;&lt;p&gt;For the full list of configuration details for various databases, see &lt;a class='external' href=&quot;http://docs.codehaus.org/display/JETTY/DataSource+Examples&quot;&gt;Jetty DataSource+Examples&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; As stated in the Jetty documentation, the above entries can be updated in &lt;tt&gt;jetty-env.xml&lt;/tt&gt; or &lt;tt&gt;jetty-web.xml&lt;/tt&gt; as well. The scope of this configuration depends on where you put this configuration information.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;2. Now, search for the following section in your &lt;tt&gt;jetty.xml&lt;/tt&gt; (or the &lt;tt&gt;run.rb&lt;/tt&gt; file):&lt;/b&gt;&lt;/p&gt;&lt;pre&gt;    &amp;lt;New class=&amp;quot;org.mortbay.jetty.webapp.WebAppContext&amp;quot;&amp;gt;
&lt;/pre&gt;&lt;p&gt;
Add the following entries after the two &amp;lt;Arg&amp;gt; entries:
&lt;/p&gt;&lt;pre&gt;    &amp;lt;Set name=&amp;quot;ConfigurationClasses&amp;quot;&amp;gt;
    &amp;lt;Array id=&amp;quot;plusConfig&amp;quot; type=&amp;quot;java.lang.String&amp;quot;&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.WebInfConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.plus.webapp.EnvConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.plus.webapp.Configuration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.JettyWebXmlConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;Item&amp;gt;org.mortbay.jetty.webapp.TagLibConfiguration&amp;lt;/Item&amp;gt;
    &amp;lt;/Array&amp;gt;
    &amp;lt;/Set&amp;gt;
&lt;/pre&gt;&lt;p&gt;&lt;b&gt;3. Specify the JNDI Logical Name for the web application.&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;Add the following entries in your &lt;tt&gt;web.xml&lt;/tt&gt; under WEB-INF folder of your war file. 

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Every time you run the rake task - war:standalone:run, web.xml is recreated.  Therefore, I suggest that you modify the rails-integration war plugin library &lt;tt&gt;create_war.rb&lt;/tt&gt; and add the entries below in the appropriate place.
&lt;/p&gt;&lt;pre&gt;    &amp;lt;resource-ref&amp;gt;
    &amp;lt;description&amp;gt;My DataSource Reference&amp;lt;/description&amp;gt;
    &amp;lt;res-ref-name&amp;gt;jdbc/MyApp&amp;lt;/res-ref-name&amp;gt;
    &amp;lt;res-type&amp;gt;javax.sql.DataSource&amp;lt;/res-type&amp;gt;
    &amp;lt;res-auth&amp;gt;Container&amp;lt;/res-auth&amp;gt;
    &amp;lt;/resource-ref&amp;gt;
&lt;/pre&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; In the trunk version, the above entries are already added.  All you have to do is setup the JNDI name in the property &lt;tt&gt;datasource_jndi_name&lt;/tt&gt; inside &lt;tt&gt;war_config.rb&lt;/tt&gt;.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;4. To add JNDI support, Jetty requires two more libraries: Jetty-Naming and Jetty-Plus.&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;The best way to do this is to modify the rails-integration war plugin library &lt;tt&gt;war_config.rb&lt;/tt&gt;. Search for &lt;tt&gt;add_jetty_library&lt;/tt&gt; and append the following lines telling the war_config to download the two libraries as well:
&lt;/p&gt;&lt;pre&gt;    add_jetty_library(maven_library('org.mortbay.jetty', 'jetty-plus', '6.1.1'))
    add_jetty_library(maven_library('org.mortbay.jetty', 'jetty-naming', '6.1.1'))
&lt;/pre&gt;&lt;p&gt;&lt;b&gt;5. Modify your &lt;tt&gt;database.yml&lt;/tt&gt; to use JNDI.&lt;/b&gt;&lt;/p&gt;&lt;pre&gt;    production:
      adapter: jdbc
      jndi: java:comp/env/jdbc/MyApp
      driver: oracle
&lt;/pre&gt;&lt;p&gt;
Thats it! Your rails web application is ready to run with JNDI Data source.

&lt;/p&gt;&lt;h3&gt;&lt;a name='How_do_I_use_a_specific_JRuby_release?'&gt;&lt;/a&gt; How do I use a specific JRuby release? &lt;/h3&gt;
&lt;p&gt;Add the following line to &lt;tt&gt;config/war.rb&lt;/tt&gt;&lt;/p&gt;&lt;pre&gt; maven_library 'org.jruby', 'jruby-complete', '0.9.9-SNAPSHOT'
&lt;/pre&gt;&lt;h3&gt;&lt;a name='Which_version_of_Rails_is_used?'&gt;&lt;/a&gt; Which version of Rails is used? &lt;/h3&gt;
&lt;p&gt;If RAILS_GEM_VERSION is set in &lt;tt&gt;environment.rb&lt;/tt&gt;, this will be used. Otherwise, the latest installed release of Ruby on Rails is used.

&lt;/p&gt;&lt;p&gt;However, you might want to manually specify a version of Rails to use. This can be done by adding a gem dependency to &lt;tt&gt;config/war.rb&lt;/tt&gt;, such as:
&lt;/p&gt;&lt;pre&gt; add_gem 'rails', '= 1.2.3'
&lt;/pre&gt;&lt;h3&gt;&lt;a name='Can_I_use_servlet_filters?'&gt;&lt;/a&gt; Can I use servlet filters? &lt;/h3&gt;
&lt;p&gt;Yes you can. There is an example on how to do this on the &lt;a href='&lt;?url_for_page CAS filter?&gt;' class='internal'&gt;CAS filter&lt;/a&gt; page.

&lt;/p&gt;&lt;h3&gt;&lt;a name='How_do_you_add_JAR_files_to_the_resulting_webapp?'&gt;&lt;/a&gt; How do you add JAR files to the resulting webapp? &lt;/h3&gt;
&lt;p&gt;Put them under &lt;tt&gt;lib/java&lt;/tt&gt; (create that directory if needed), and they'll propagate to the resulting web application.  

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; I had to add a maven_library directive to my &lt;tt&gt;config/war.rb&lt;/tt&gt; to make this work. In GoldSpike 1.3, &lt;tt&gt;include_library(name,version)&lt;/tt&gt; in &lt;tt&gt;config/war.rb&lt;/tt&gt; is supposed to provide the ability to add Java libraries from either &lt;tt&gt;lib/java&lt;/tt&gt; or &lt;tt&gt;JRUBY_HOME/lib&lt;/tt&gt;, but the functionality has been broken for a while. A patch is available here:&lt;br /&gt;&lt;a class='external' href=&quot;http://rubyforge.org/tracker/index.php?func=detail&amp;aid=13963&amp;group_id=2014&amp;atid=7859&quot;&gt;http://rubyforge.org/tracker/index.php?func=detail&amp;amp;aid=13963&amp;amp;group_id=2014&amp;amp;atid=7859&lt;/a&gt;

&lt;/p&gt;&lt;h3&gt;&lt;a name='Which_Java_EE_servers_can_I_use_?'&gt;&lt;/a&gt; Which Java EE servers can I use ? &lt;/h3&gt;
&lt;p&gt;GoldSpike has been tested on:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://glassfish.dev.java.net&quot;&gt;GlassFish&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://jetty.mortbay.org/&quot;&gt;Jetty&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://tomcat.apache.org/&quot;&gt;Tomcat&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.bea.com/weblogic/&quot;&gt;WebLogic&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.ibm.com/developerworks/websphere/techjournal/0801_shillington/0801_shillington.html&quot;&gt;WebSphere&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='How_do_I_add_dependent_gems_to_the_war?'&gt;&lt;/a&gt; How do I add dependent gems to the war? &lt;/h3&gt;
&lt;p&gt;Use 'add_gem' in war.rb.  For example:
&lt;/p&gt;&lt;pre&gt; add_gem 'rmagick4j', '= 0.3.3'
&lt;/pre&gt;&lt;h3&gt;&lt;a name='How_do_I_configure_the_number_of_requests_GoldSpike_can_handle?'&gt;&lt;/a&gt; How do I configure the number of requests GoldSpike can handle? &lt;/h3&gt;
&lt;p&gt;The number of simultaneous requests GoldSpike can process is based on the number of JRuby runtimes it creates.

&lt;/p&gt;&lt;p&gt;Once GoldSpike has been run, it will create &lt;tt&gt;WEB-INF/web.xml&lt;/tt&gt; under your Rails application.
The following &lt;tt&gt;context-params&lt;/tt&gt; in &lt;tt&gt;web.xml&lt;/tt&gt; can be used to configure GoldSpike:

&lt;/p&gt;&lt;p&gt;Maximum number of runtimes:
&lt;/p&gt;&lt;pre&gt; jruby.pool.maxActive (defaults to 4)
&lt;/pre&gt;&lt;p&gt;Minimum number of runtimes:  
&lt;/p&gt;&lt;pre&gt; jruby.pool.minIdle (defaults to 2)
&lt;/pre&gt;&lt;p&gt;Initial number of runtimes:
&lt;/p&gt;&lt;pre&gt; jruby.pool.initialSize (defaults to jruby.pool.minIdle)
&lt;/pre&gt;&lt;p&gt;How often in milliseconds to check if more runtimes are needed:
&lt;/p&gt;&lt;pre&gt; jruby.pool.checkInterval (defaults to 1000)
&lt;/pre&gt;&lt;h3&gt;&lt;a name='What_should_I_do?_I_get_&amp;quot;Could_not_load_Rails._See_the_logs_for_more_details.&amp;quot;_error_message.'&gt;&lt;/a&gt; What should I do? I get &amp;quot;Could not load Rails. See the logs for more details.&amp;quot; error message. &lt;/h3&gt;
&lt;p&gt;This means that an exception was thrown while GoldSpike attempted to initialize the Rails application. This can be caused by a number of problems, for example:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; Failure to connect to the database
&lt;/li&gt;&lt;li&gt; Missing gems from the war
&lt;/li&gt;&lt;li&gt; Missing required jars which are loaded from &lt;tt&gt;environment.rb&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
The best way to go about debugging this is to check the container log file. It should show the message and trace for the exception that was encountered.

&lt;/p&gt;&lt;h3&gt;&lt;a name='How_do_I_avoid_bundling_files_such_as_.svn,_.DS_Store,_etc._into_the_WAR_file?'&gt;&lt;/a&gt; How do I avoid bundling files such as .svn, .DS_Store, etc. into the WAR file? &lt;/h3&gt;
&lt;p&gt;I would LOVE to find the &amp;quot;proper&amp;quot; answer to this. I tried adding the following to &lt;tt&gt;war.rb&lt;/tt&gt;, but it only caused an exclusion at the top level, possibly because the file list that finally gets passed to the &lt;tt&gt;jar&lt;/tt&gt; command is only a list of the top-level files and directories:
&lt;/p&gt;&lt;pre&gt; exclude_files File.join(&amp;quot;.&amp;quot;,&amp;quot;**&amp;quot;,&amp;quot;.svn&amp;quot;)
&lt;/pre&gt;&lt;p&gt;
I ended up having to hack the GoldSpike code to run the following zip command immediately after the WAR file was built (in &lt;tt&gt;packer.rb&lt;/tt&gt;), which removes the designated files from the jar manually, throughout the ENTIRE jar file:
&lt;/p&gt;&lt;pre&gt; zip -q -d #{os_target_file} \*.svn/\* \*.DS_Store
&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;os_target_file is the .jar filename
&lt;/li&gt;&lt;li&gt; .DS_Store is the OS X directory metadata file. 
&lt;/li&gt;&lt;li&gt; Backslashes are significant and necessary: See the zip man page!
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
I can't think of a circumstance when you wouldn't want to exclude these files from a WAR, so I didn't make it an option. Works great.

&lt;/p&gt;&lt;h3&gt;&lt;a name='web.xml_Notes'&gt;&lt;/a&gt; web.xml Notes &lt;/h3&gt;
&lt;p&gt;&lt;i&gt;After running warbler and looking at the resulting web.xml I was able to infer the following - please add or correct. Thx&lt;/i&gt;

&lt;/p&gt;&lt;p&gt;Within your web.xml you can set the following to tailor the WAR structure to your liking. Set inside &amp;lt;web-app&amp;gt; like:

&lt;/p&gt;&lt;p&gt;&lt;pre&gt;
 &amp;lt;context-param&amp;gt;
 	&amp;lt;param-name&amp;gt;jruby.standalone&amp;lt;/param-name&amp;gt;
 	&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
 &amp;lt;/context-param&amp;gt;
&lt;/pre&gt;

&lt;/p&gt;&lt;pre&gt; jruby.standalone - true/false (what does this do?)
 jruby.session_store - &amp;quot;db&amp;quot;
 jruby.home
 jruby.pool.maxActive - 4
 jruby.pool.minIdle - 2
 jruby.pool.checkInterval - 1000 (ms)
 jruby.pool.maxWait - 30000 (ms)
 
 rails.root - path to rails app within the war file / webapp dir
 rails.env  - development|test|production
 
 files.root - absolute path to public files within the war file / webapp dir
 files.default - servlet id to use if a file cannot be found
 files.prefix - prefix added to static files
 files.welcome -
&lt;/pre&gt;&lt;p&gt;
As with Rails, if a static file exists it will be served, otherwise it will try to dispatch via Rails.

&lt;/p&gt;&lt;p&gt;Static file requests are (can be) serviced via &lt;tt&gt;org.jruby.webapp.FileServlet&lt;/tt&gt;.

&lt;/p&gt;&lt;p&gt;Rails requests are serviced via &lt;tt&gt;org.jruby.webapp.RailsServlet&lt;/tt&gt;.

&lt;/p&gt;&lt;p&gt;You should map / through the FileServlet
&lt;pre&gt;
 &amp;lt;servlet-mapping&amp;gt;
 	&amp;lt;servlet-name&amp;gt;files&amp;lt;/servlet-name&amp;gt;
 	&amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;
 &amp;lt;/servlet-mapping&amp;gt;
&lt;/pre&gt;

&lt;/p&gt;&lt;p&gt;Additionally, System Properties you can set:

&lt;/p&gt;&lt;pre&gt; jruby.objectspace.enabled
 gem.path
 gem.home
&lt;/pre&gt;&lt;h2&gt;&lt;a name='More_Information'&gt;&lt;/a&gt; More Information &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://blogs.sun.com/arungupta/entry/rails_and_java_ee_integration&quot;&gt;Rails and Java EE integration - Servlet co-bundled and invoked from Rails app&lt;/a&gt; (Arun Gupta)
&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://rubyforge.org/mail/?group_id=2014&quot;&gt;RubyForge jruby-extras-devel Archives&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;a name='Release_roadmap'&gt;&lt;/a&gt; Release roadmap &lt;/h2&gt;
&lt;h3&gt;&lt;a name='1.5_-_January_08'&gt;&lt;/a&gt; 1.5 - January 08 &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; JRuby 1.1 support
&lt;/li&gt;&lt;li&gt; Rails 2.0 support
&lt;/li&gt;&lt;li&gt; Deprecate plugin, recommend the use of Warbler
&lt;/li&gt;&lt;li&gt; Bug 16108 - HttpOutput flush doesn't send headers - Patch by Matt Burke
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='1.4_-_December_07'&gt;&lt;/a&gt; 1.4 - December 07 &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; Allow FileServlet to work even if activation.jar is not present at runtime
&lt;/li&gt;&lt;li&gt; Make rails.root param assume it's relative to the webapp
&lt;/li&gt;&lt;li&gt; Make pom download and install rails if necessary
&lt;/li&gt;&lt;li&gt; Added periodical task scheduler
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='1.3_-_August_07'&gt;&lt;/a&gt; 1.3 - August 07 &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; Update to JRuby 1.0.1
&lt;/li&gt;&lt;li&gt; Support for WebLogic (tested with 9.2)
&lt;/li&gt;&lt;li&gt; Fix PUT, DELETE, etc requests not being passed on to RailsServlet.
&lt;/li&gt;&lt;li&gt; Add support for HEAD requests to FileServlet.
&lt;/li&gt;&lt;li&gt; Fix for a deadlock situation
&lt;/li&gt;&lt;li&gt; Add support for adding arbitrary files to WEB-INF, also looking at timestamps and so on to not add unnecessarily.
&lt;/li&gt;&lt;li&gt; Spring plugin
&lt;/li&gt;&lt;li&gt; Support for caching, by Li Xiao.
&lt;/li&gt;&lt;li&gt; Drop support for preparsing the syntax tree
&lt;/li&gt;&lt;li&gt; Don't add AR-JDBC or Rails gems if they're already added to vendor. By Michael Schubert.
&lt;/li&gt;&lt;li&gt; Servlet configuration templates are now created by a generator. By Bryan Liles.
&lt;/li&gt;&lt;li&gt; Support staggered start up of background tasks
&lt;/li&gt;&lt;li&gt; Make the servlet context directly available to Rails applications as $servlet_context
&lt;/li&gt;&lt;li&gt; Added RailsTaskServlet that makes it possible to run other Rails tasks such as for example ActiveMessaging
&lt;/li&gt;&lt;li&gt; Moved all runtime pool management out into a listener, for proper lifecycle management
&lt;/li&gt;&lt;li&gt; Added support for rails page caching
&lt;/li&gt;&lt;li&gt; Make system environment variables available at request time
&lt;/li&gt;&lt;li&gt; Running an embedded Jetty will now use RAILS_ENV (with a default of 'development') as the rails environment
&lt;/li&gt;&lt;li&gt; Assemble web application in place rather than using tmp/war
&lt;/li&gt;&lt;li&gt; MIT license
&lt;/li&gt;&lt;li&gt; Changed File.install to File.copy to improve performance
&lt;/li&gt;&lt;li&gt; Fix gem install courtesy Jeffrey Damick
&lt;/li&gt;&lt;li&gt; FileServlet can serve directly from an absolute paths
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='1.2_-_May_07'&gt;&lt;/a&gt; 1.2 - May 07 &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; Bug 9711 - Tomcat 4 support
&lt;/li&gt;&lt;li&gt; Bug 10265 - Http session store
&lt;/li&gt;&lt;li&gt; Tests work with JDK 1.4
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='1.1.1_-_April_23,_2007'&gt;&lt;/a&gt; 1.1.1 - April 23, 2007 &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; Bug 9321 - Better performance / Glassfish support (no runtime installation)
&lt;/li&gt;&lt;li&gt; Bug 9654 - JDK 1.4 support
&lt;/li&gt;&lt;li&gt; Enhancement 9999 - Support JNDI datasources
&lt;/li&gt;&lt;li&gt; Enhancement 10068 - Edge rails support
&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; Bug 9320 - NullpointerException in AbstractRailsServlet
&lt;/li&gt;&lt;li&gt; Bug 9394 - Allow deployment to root
&lt;/li&gt;&lt;li&gt; Bug 9419 - Ensure that ARGV is always available
&lt;/li&gt;&lt;li&gt; Enhancement 9710 - add_gem for config file
&lt;/li&gt;&lt;li&gt; Bug 9722 - Allow both symbols and strings for session keys
&lt;/li&gt;&lt;li&gt; Enhancement 10069 - Extra excludes paths
&lt;/li&gt;&lt;li&gt; Bug 10190 - java_library creates corrupt jar-files on windows
&lt;/li&gt;&lt;li&gt; Bug 10265 - fix marshalling issue with http servlet session store
&lt;/li&gt;&lt;/ul&gt;</text-as-html>
  <updated-at type="datetime">2009-07-13T16:36:10Z</updated-at>
  <wiki-id type="integer">320</wiki-id>
</page>
