10分じゃできなかった “Hello World” on JRuby/GAE までの長い道のり

Google App Engine が Ruby信者にとっての踏み絵に思えて仕方のない三寒四温の今日この頃、皆さまいかがお過ごしでしょうか。

Chiba.rb の会合をなんと鴨川でやるということになり、迂闊にもこんな発言をしてしまいました。

https://groups.google.com/group/chiba_rb/msg/ff7c6ebb9fe22058?hl=ja

高梨@鴨川です。
こしばさん、お誘いとご提案、本当にありがとうございます。 m(__)m
鴨川での開催はいつでもウェルカムです。場所取りはなんとかしますので。
あと、わたし的にご提供できるネタとしては

* RoR on GAE (環境は構築したものの未着手w)
* mod_rubinius 構想 (計画段階)

という非常に中途半端なものがあります。(笑 まあ勉強会のために勉強するのが自分のためにもなる、と思っておりますので ご容赦ください。
皆様、これからもよろしくお願い致します。

場所取り云々は知り合いに頼んだのでなんとかなるとして、問題は発表するネタのとこです。

最近、仕事の案件はPHPべったり、ホビープログラミングはGAEのPythonべったりだったので、Rubyからは遠ざかっていました。まあこんな記事もあることだし、ちゃっちゃとできるっぺ、とタカをくくっていました。そんなところが房州天津人の甘いところです。現実はいつも厳しいもの。

ええとまず、ソフトは出来る限り最新の物をというポリシーで生きてますので、/usr/local/bin/ruby -v の出力はもちろん1.9.2-p180でした。でも、これが良くないらしいということに気づいたのが、作業開始から 30分ほど経ってから。

で、rvm というもので複数バージョンのRubyを共存できるらしいと知り、rvm環境内に1.8.7系をインストールするのに20分。

さて、大変なのはここからでした。まず、「10分ではじめる GAE/JRuby (OAuth + Sinatraのサンプル)」という記事の日付ですが 2009年9月3日になっています。つまり、もう1年以上前の情報。そこからたどれるのもそれより前のものです。というわけで、JRuby/GAE にも変更があります。

結果としては以下のような手順になります。

$ rvm install 1.8.7
$ rvm use 1.8.7
$ gem install google-appengine -v "0.0.19"
$ cd /to/your/source/directory/
$ appcfg.rb generate_app appid
$ dev_appserver.rb appid

これで開発用ローカルサーバが立ち上がりますが 、

javax.servlet.ServletContext log: WARNING: no rackup script found. Starting empty Rack application.

という不吉な警告が出ます。http://localhost:8080/にアクセスすると、案の定

Internal Server Error (500)

になります。で、これの原因は jruby-rack のバージョンが「新しすぎる」ためで、Gemfile 中で1.0.6 未満を指定するとうまくいきます。こんな感じ。

$ cat appid/Gemfile
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path ".gems/bundler_gems"
# List gems to bundle here:
gem "jruby-rack", "< 1.0.6"
gem 'appengine-rack'

で、改めて dev_appserver を立ち上げて、ブラウザでアクセスすると・・・

Hello

キタ━━━━(゚∀゚)━━━━!! 表示されました!

コマンドラインだけ並べるとなんてことないですが、原因追究してもエラーメッセージぐぐっても思うような情報が得られなかったり、でさんざん苦労しました。

つーか最新バージョンでうまく動かないってのはどうなんでしょーね。私の環境を書いておくと

$ uname -a
Linux messarina 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:46 UTC 2011 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.10
Release:	10.10
Codename:	maverick$ java -version
java version "1.6.0_24"Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

こんな感じで特別なわけではないんですが。

Railsまでたどり着くにはまた別の道のりが必要でしょうが、ここまでの作業で私は心が折れました。orz

とりあえず自分がやりたいことにRailsは必要なくて、JRubyが動けばいいだけなので、今日のところはここまでにします。皆さまの健闘を祈ります。

12 Comments

Got Something To Say:

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

Really no matter if someone doesn’t understand after that its up to
other visitors that they will assist, so here it occurs.

Hey there! Do you use Twitter? I’d like to follow you if that would
be ok. I’m undoubtedly enjoying your blog and look forward to new posts.

I have to thank you for the efforts you have put in writing this
site. I’m hoping to view the same high-grade blog
posts by you later on as well. In truth, your creative writing abilities has encouraged me to
get my very own site now ;)

You made some good points there. I looked on the web to find out more about the issue and found most people will go along with your views on this website.

You actually make it seem so easy with your presentation but I find this topic to be really something which I think
I would never understand. It seems too complicated and
very broad for me. I am looking forward for your next
post, I will try to get the hang of it!

Undeniably believe that which you stated.
Your favorite reason seemed to be on the web the simplest thing to be aware
of. I say to you, I certainly get annoyed while people consider worries that they just do not know about.
You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people
can take a signal. Will probably be back to get more.
Thanks

Here is my website :: click here (Trinidad)

Fastidious response in return of this query with genuine arguments and telling all
regarding that.

Iphone Unlocking is straightforward and guidelines are given within the webpage.

seo consultant orange county is a organization or immovable that helps iin optimizing
your website. It’s interesting because a lot of the elements are located on the left
side which means you will have to put some emphasis on the right side to either
even it out or not cover up and of design.

Feel free to surf to my weblog http://www.youtube.com/watch?v=ZJZ3ErrTUqg

I am regular reader, how are you everybody? This post posted at this website is genuinely good.

Angelina Ballerina: In The Wings (2004)Follow the adventures of Angelina, an ambitious, headstrong young mouse who
dreams of becoming a prima ballerina. Directed by Jean-Pierre Melville, this intense French film noir co-stars Catherine Deneuve.

Coffy appoints herself judge, jury and executioner in this
classic 1970s blaxploitation flick.

So the question is how can I read anywhere, yet protect my investment.
To begin your search, you must decide the covering material is better suited your
interior, your personal style and your budget. It would depend on what kind of material
you wanted to get as a replacement.

Copyright © 2024. Powered by WordPress & Romangie Theme.