Archive for the ‘Rails’ Tag

How to run JRuby on Rails on Google’s App Engine

Are you wondering how to install your JRuby on Rails application on Google’s App Engine?

If so, go to this cookbook.

I have not tried yet, but I’ll try soon.

See you! Leo

Warbler 0.9.9 default servlet filter config doesn’t work with Websphere 6.1

Many people have been facing some issue when trying to deploy a JRuby on Rails package using Warbler on WebSphere AS 6.1.

One workaround is to copy the file JRUBY_HOME/lib/ruby/gems/1.8/gems/warbler-0.9.9/web.xml.erb to your app/config diretory and change it to use a Servlet instead of a Filter as below:

<!DOCTYPE web-app PUBLIC

“-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”

  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <% webxml.context_params.each do |k,v| %>
  <context-param>
      <param-name><%= k %></param-name>
      <param-value><%= v %></param-value>
  </context-param>
  <% end %>

  <listener>
      <listener-class><%= webxml.servlet_context_listener %></listener-class>
  </listener>

  <servlet>
      <servlet-name>Rails</servlet-name>
      <servlet-class>org.jruby.rack.RackServlet</servlet-class>
  </servlet>

  <servlet-mapping>
      <servlet-name>Rails</servlet-name>
      <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <% if webxml.jndi then webxml.jndi.each do |jndi| %>
  <resource-ref>
      <res-ref-name><%= jndi %></res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
  <% end; end %>
</web-app>

Also instead of changing the web.xml.erb file to use Servlet you can configure your WebSphere AS to work with Rack Filter. To do that you have to:

1. Start the Websphere server and open the Administration Console
2. Set a Websphere web container custom property com.ibm.ws.webcontainer.invokefilterscompatibility = true.

If you have some difficult to find where to set this configuration tell me and I will give you the step-by-step.

I hope this tip be useful for everyone that is getting to work with JRuby On Rails on WebSphere.

All the best,

Leo