<?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>ActivoRicordi Captain's log &#187; sap netweaver</title>
	<atom:link href="http://blog.activoricordi.com/tag/sap-netweaver/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.activoricordi.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 25 Aug 2010 15:22:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Jruby on Rails on SAP NetWeaver Studio</title>
		<link>http://blog.activoricordi.com/2009/08/jruby_on_rails_nwds/</link>
		<comments>http://blog.activoricordi.com/2009/08/jruby_on_rails_nwds/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 10:40:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JRuby]]></category>
		<category><![CDATA[sap]]></category>
		<category><![CDATA[JRuby on Rails]]></category>
		<category><![CDATA[sap netweaver]]></category>

		<guid isPermaLink="false">http://blog.activoricordi.com/?p=50</guid>
		<description><![CDATA[Many of you have already heard about JRuby and its Rails implementation called JRuby on Rails, for those who do not I would recommend to read the following articles: JRuby: The power of Java and Ruby This article which clearly explain the basics is about JRuby. This article from Java World gives an overview JRuby [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you have already heard about JRuby and its Rails implementation called JRuby on Rails, for those who do not I would recommend to read the following articles:</p>
<ul>
<li><a href="http://www.youtube.com/watch?v=PfnP-8XbJao">JRuby: The power of Java and Ruby</a></li>
<li>This <a href="http://www.javaworld.com/javaworld/jw-07-2006/jw-0717-ruby.html">article</a> which clearly explain the basics is about JRuby.</li>
<li>This <a href="http://www.javaworld.com/javaworld/jw-02-2007/jw-02-jruby.html">article</a> from Java World gives an overview JRuby on Rails. </li>
<li>Additionally, there is another <a href="http://www.developer.com/lang/other/article.php/10942_3662031_2">article</a> from Developer.com which runs over the first steps on creating and deploying a JRuby on Rails application.</li>
</ul>
<p>Ok, once we are all on the same page, I am going to make a more detailed overview, on how to develop a JRuby on Rails project using SAP NetWeaver Studio. Just to mention that I am currently using version 7.1 SP6 which is built over Eclipse 3.3.0 and Java 5 Sdk.  I know it is a little bit more advanced than the most mayority of current SAP projects, which are probably using SAP NetWeaver Studio 7.0 but well, it is what I have.</p>
<p>There is an existing one-click installer from <a href="http://bitnami.org/stack/jrubystack">JRuby on Rails </a>suitable for testing for a company called bitnami, which has a very interesting market proposition. I am myself I use RubyStack with no futher problems.<br />
However, I have done manually to fully understand the development architecture. So let se which are the steps to perform:</p>
<p>1) Download JRuby: As first step, we are going to download latest version of JRuby from <a href="http://jruby.codehaus.org/">JRuby site</a>. In this case is JRuby 1.1.4, which can be download from its <a href="http://dist.codehaus.org/jruby/">repositories</a>. Select what it suits for your operating system.</p>
<p>While you wait it to download, if you like you can read something or you want watch a video related to JRuby on Rails, plese the following video:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/PfnP-8XbJao&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/PfnP-8XbJao&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowfullscreen="true"></embed></object></p>
<p>Ok, now it is already download, we have to find the file and unzip. Do not underestimate the time it takes to find the file wherever you have download it. <img src='http://blog.activoricordi.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>As I always install my Jvm on the root directory of my C: drive (c:\jdk15,c:\jdk16,..) . I am going to follow the same procedure again, as it will ease the procedure of adding it to my PATH route. I do not know you but I am a little tired of adding things to my PATH, that I am not going to use so I have created a .bat file which do this for me. For more details about <a class="wp-caption" title="JRuby Getting Started" href="http://wiki.jruby.org/wiki/Getting_Started" target="_blank">how to getting started</a>. Obviously, it is designed to support my best practices, but you know today is &#8220;Convention over configuration&#8221; or DIY.</p>
<p>Prerequisites</p>
<p>JRuby 1.1.3 or higher<br />
Java 5 or higher<br />
Rails 2.0 or higher</p>
<p> Install Rails Framework &#8216;gems install rails -y&#8217; (if behind a http proxy, set HTTP_PROXY=http://${http-proxy-host}:${http-proxy-port}/)<br />
4. Install activerecord-jdbc &#8216;gems install activerecord-jdbc&#8217;<br />
5. Install database/jdbc driver (for mysql <a href="http://mysql.com/">http://mysql.com/</a>)<br />
6. Generate your Ruby on Rails application (<a href="http://rubyonrails.org/">http://rubyonrails.org/</a>)<br />
7. Modify database.yaml<br />
       development:<br />
           adapter: jdbc<br />
           driver: com.mysql.jdbc.Driver (for mysql)<br />
           url: jdbc:mysql://${database-hostname}/${db-schema}<br />
           username: ${username}<br />
           password: ${password}</p>
<p>8. Modify environment.rb by adding<br />
       require &#8216;active_record/connection_adapters/jdbc_adapter&#8217;</p>
<p>9. Download rails-integration-${version}-SNAPSHOT.jar into the WEB-INF/lib by checking out and building the rails-integration project<br />
svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration<br />
10. Modify the template web.xml(see references below) with the right value of jruby.home<br />
11. Create a WEB-INF directory in the RoR application directory<br />
12. Copy web.xml to WEB-INF and rails-integration-${version}-SNAPSHOT.jar under WEB-INF/lib<br />
13. Jar up the RoR application directory contents as a WAR file</p>
<p>Requests to appropriate context-root of the deployed web application should invoke your Ruby code !</p>
<p>If you&#8217;d like to automate the building of a war file:<br />
Edit rails-integration/build.xml and add the following XML snippet<br />
  &lt;property environment=&#8221;env&#8221;/&gt;<br />
  &lt;target name=&#8221;build-rails-war&#8221; depends=&#8221;jar&#8221;&gt;<br />
    &lt;delete file=&#8221;${rails-app-dir}/${rails-app-name}.war&#8221;/&gt;<br />
    &lt;mkdir dir=&#8221;${rails-app-dir}/WEB-INF/lib&#8221;/&gt;<br />
    &lt;copy todir=&#8221;${rails-app-dir}/WEB-INF/lib&#8221;&gt;<br />
      &lt;fileset file=&#8221;${maven.build.directory}/${maven.build.final.name}.jar&#8221;/&gt;<br />
      &lt;fileset file=&#8221;${maven.repo.local}/org/jruby/jruby/0.9.1/jruby-0.9.1.jar&#8221;/&gt;<br />
      &lt;fileset file=&#8221;${maven.repo.local}/asm/asm/2.2.2/asm-2.2.2.jar&#8221;/&gt;<br />
      &lt;fileset file=&#8221;${maven.repo.local}/javax/activation/activation/1.1/activation-1.1.jar&#8221;/&gt;<br />
    &lt;/copy&gt;<br />
    &lt;copy todir=&#8221;${rails-app-dir}/WEB-INF/&#8221;&gt;<br />
      &lt;fileset file=&#8221;samples/scaffold/WEB-INF/web.xml&#8221;/&gt;<br />
    &lt;/copy&gt;<br />
    &lt;replace file=&#8221;${rails-app-dir}/WEB-INF/web.xml&#8221; token=&#8221;/usr/local/jruby&#8221; value=&#8221;${env.JRUBY_HOME}&#8221;/&gt;<br />
    &lt;jar jarfile=&#8221;${rails-app-dir}/${rails-app-name}.war&#8221; basedir=&#8221;${rails-app-dir}&#8221;/&gt;<br />
  &lt;/target&gt;<br />
Make sure JRUBY_HOME is set and run<br />
&#8216;ant -Drails-app-dir=${ror-app-dir} -Drails-app-name=${war-file-name} build-rails-war&#8217;<br />
${ror-app-dir}/${ror-app-name}.war should be ready for deployment !</p>
<p><code>jruby -S gem install -y rails warbler</code><br />
<code><br />
$JRUBY_HOME/bin/gem install activerecord-jdbc-adapter -y</code><br />
modify database.yml<br />
<code><br />
development:<br />
adapter: jdbc<br />
driver: com.mysql.jdbc.Driver<br />
url: jdbc:mysql://localhost/blabla_development<br />
username: root<br />
password: root<br />
</code><br />
Modify environment.rb<br />
<code><br />
require File.join(File.dirname(__FILE__), 'boot')<br />
if RUBY_PLATFORM =~ /java/<br />
require 'rubygems'<br />
RAILS_CONNECTION_ADAPTERS = %w(jdbc)<br />
end</code>I would recommend to read of <a href="http://blog.emptyway.com/">The empty Way</a><br />
<a href="http://wordpress.com/tag/jruby/">JRuby entries on WordPress</a></p>
<p>Rails::Initializer.run do |config|</p>
<p>This article is based on the following references:</p>
<ul>
<li><a href="http://wiki.jruby.org/wiki/JRuby_on_Rails">Wiki JRuby on Rails</a></li>
<li><a href="http://luposlip.blogspot.com/2007/07/solved-jror-goldspike-netweaver.html">Solved: JRoR, GoldSpike + NetWeaver</a></li>
<li><a href="http://blog.headius.com/2006/11/advanced-rails-deployment-with-jruby.html">Advanced Rails Deployment with JRuby</a></li>
<li><a href="http://blogs.sun.com/whacko/entry/deploying_a_ruby_on_rails"></a></li>
</ul>
<p>Kind regards</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.activoricordi.com/2009/08/jruby_on_rails_nwds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
