<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Extra Thimian &#187; JRuby</title>
	<atom:link href="http://blog.thimian.com/category/jruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thimian.com</link>
	<description>Suddenly Fiction</description>
	<lastBuildDate>Sun, 14 Feb 2010 04:03:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>I am lazy. That&#8217;s why I like J2EE</title>
		<link>http://blog.thimian.com/2008/05/07/i-am-lazy-thats-why-i-like-j2ee/</link>
		<comments>http://blog.thimian.com/2008/05/07/i-am-lazy-thats-why-i-like-j2ee/#comments</comments>
		<pubDate>Wed, 07 May 2008 18:52:00 +0000</pubDate>
		<dc:creator>Phill</dc:creator>
				<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[English Language Posts]]></category>
		<category><![CDATA[Glassfish]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thimian.com/2008/05/07/i-am-lazy-thats-why-i-like-j2ee/</guid>
		<description><![CDATA[No, really. Without J2EE, I wouldn&#8217;t have access to Glassfish, with its wonderful autodeploy directory to, well, autmatically delpoy applications on it.
Without Java, I wouldn&#8217;t be able to use JRuby.
And neither would I be able to use Warbler to create .war-files for drag and drop deployment.
In the span of 30 minutes (half of which is [...]]]></description>
			<content:encoded><![CDATA[<p>No, really. Without J2EE, I wouldn&#8217;t have access to <a class="zem_slink" title="GlassFish" rel="homepage" href="http://glassfish.java.net/" target="_blank">Glassfish</a>, with its wonderful autodeploy directory to, well, autmatically delpoy applications on it.</p>
<p>Without Java, I wouldn&#8217;t be able to use <a class="zem_slink" title="JRuby" rel="homepage" href="http://jruby.codehaus.org/" target="_blank">JRuby</a>.</p>
<p>And neither would I be able to use Warbler to create<span style="font-family: courier new;"> .war</span>-files for drag and drop deployment.</p>
<p>In the span of 30 minutes (half of which is related to my underspec&#8217;d development environment), I was able to deploy a Rails application.</p>
<p>First, you need to setup your Rails application for use with JDBC. In Rails 2.0 it is as easy as this <span style="font-family: courier new;">database.yml</span>:</p>
<blockquote style="font-family: courier new;"><p>development:<br />
host: localhost<br />
adapter: jdbc<br />
driver: com.mysql.jdbc.Driver<br />
url: jdbc:mysql://localhost:3306/application_db<br />
username:<br />
password:</p></blockquote>
<p>With the Warbler gem, you can easily create a <a class="zem_slink" title="Sun WAR (file format)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Sun_WAR_%28file_format%29" target="_blank">war file</a>:</p>
<blockquote style="font-family: courier new;"><p>jruby -S warble war</p></blockquote>
<p>To fine-tune your configuration (if Warble&#8217;s defaults aren&#8217;t as good for you as they could), just run</p>
<blockquote style="font-family: courier new;"><p>jruby -S warble config</p></blockquote>
<p>You can edit the resulting <span style="font-family: courier new;">config\warble.rb</span> for some fine tuning (I&#8217;ll have to look into it, for example how to tell it to use a specific JRuby version).</p>
<p>Once you are ready to create your <span style="font-family: courier new;">.war</span>-file:</p>
<blockquote style="font-family: courier new;"><p>jruby -S rake war:standalone:create</p></blockquote>
<p>Thsi creates a war file inculding the JRuby runtime. Drop into your domain&#8217;s autodeploy folder, and wait until Glassfish is done deploying it. Done. You have a working, deployed, and automagically scaling Rails application. No need to herd a pack of Mongrels, futy with mod_proxy, or anything else. Wonderful.</p>
<p>BUT there is one issue you migth have (whcih is unrelated to Ruby, JRuby, or Glassfish):</p>
<p>It is possible that your Rails app throws the following exception:</p>
<blockquote style="font-family: courier new;"><p>No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).</p></blockquote>
<p>Don&#8217;t fret. Either use the correct security, or change your <span style="font-family: courier new;">app/controllers/application.rb</span> so it looks like this:</p>
<blockquote style="font-family: courier new;"><p>protect_from_forgery :secret =&gt; &#8216;a_really_long_pseudo_random_hash_thing&#8217;</p></blockquote>
<p>Simply remove the comment in front of the <span style="font-family: courier new;">:secret</span>. Done. Enjoy the bonus you just ensured for yourself, since you avoided at least a day of additional deployment and configuration, and/or learning capistrano.</p>
<p>P.S.: Still working on the comparison of OpenID and CAS for Ruby, so this is a bit of filler content.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thimian.com/2008/05/07/i-am-lazy-thats-why-i-like-j2ee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.236 seconds -->
