GAE/JでRailsを動かす(5)

前回、デプロイまで成功したので、アプリが正常に動くところまで進めたいと思います。

GAEのコンソールで、ログを見ると以下のようになってました。

E 05-27 08:24AM 35.498
javax.servlet.ServletContext log: unable to create shared application instance
org.jruby.rack.RackInitializationException: no such file to load -- active_record
	from file:/base/data/home/apps/iknow-laf/1.333782736479566827/WEB-INF/lib/jruby-rack-0.9.4.jar!/jruby/rack/rails.rb:43:in `require_frameworks_with_servlet_env'
	from /base/data/home/apps/iknow-laf/1.333782736479566827/WEB-INF/config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
	from /base/data/home/apps/iknow-laf/1.333782736479566827/WEB-INF/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
	from /base/data/home/apps/iknow-laf/1.333782736479566827/WEB-INF/config/environment.rb:14

environment.rbの14行目を見てみると、

  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

コメントはずしたつもりが巻き戻ってたorz..

有効にして再度チャレンジ。

$ jruby -S warble
rake aborted!
no such file to load -- will_paginate
/usr/share/jruby-1.3.0RC1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
(See full trace by running task with --trace)

なぜかいまさらwill_paginateのgemがないと怒られ。。

$ jruby -S gem list

*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
jruby-openssl (0.5)
rails (2.3.2)
rake (0.8.4)
rspec (1.2.6)
sources (0.0.1)
warbler (0.9.13)

確かに。

$ sudo $JRUBY_HOME/bin/jruby -S gem install will_paginate
Successfully installed will_paginate-2.2.2
1 gem installed
Installing ri documentation for will_paginate-2.2.2...
Installing RDoc documentation for will_paginate-2.2.2...

では気を取り直して。

$ jruby -S warble
cp config/environment.rb tmp/war/WEB-INF/config/environment.rb
cp /usr/share/jruby-1.3.0RC1/lib/ruby/gems/1.8/gems/warbler-0.9.13/lib/jruby-complete-1.3.0RC1.jar tmp/war/WEB-INF/lib/jruby-complete-1.3.0RC1.jar
cp /usr/share/jruby-1.3.0RC1/lib/ruby/gems/1.8/gems/warbler-0.9.13/lib/jruby-complete-1.3.0RC1.jar tmp/war/WEB-INF/lib/jruby-complete-1.3.0RC1.jar
mkdir -p tmp/war/WEB-INF
jar cf laf-gae.war  -C tmp/war .
fujibee@ubuntu810server:laf-gae$ rm tmp/war/WEB-INF/lib/jruby-complete-1.3.0RC1.jar

いちいちでかいjarを削除はめんどくさい。。何とかしたいところです。

$ cd ..
$ appengine-java-sdk-1.2.1/bin/appcfg.sh update laf-gae/tmp/wa
r
Reading application configuration data...
2009-05-28 01:05:10.987::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Beginning server interaction for iknow-laf...
0% Creating staging directory
5% Scanning for jsp files.
20% Scanning files on local disk.
25% Scanned 250 files.
28% Scanned 500 files.
31% Scanned 750 files.
33% Initiating update.
34% Cloning 25 static files.
35% Cloning 778 application files.
36% Cloned 100 files.
37% Cloned 200 files.
37% Cloned 300 files.
37% Cloned 400 files.
37% Cloned 500 files.
37% Cloned 600 files.
37% Cloned 700 files.
40% Uploading 1 files.
52% Uploaded 1 files.
90% Deploying new version.
95% Will check again in 1 seconds
98% Closing update: new version is ready to start serving.
99% Uploading index definitions.

Update completed successfully.
Success.
Cleaning up temporary files...

成功しました。ちゃんと1ファイルしかアップロードされてないですね。
ということは、さっきインストールしたwill_paginateは入っていない?

とりあえずアプリにアクセスしてみると、アプリが500を返しているようです。。
エラーログを見ます。

C 05-27 05:55PM 32.638
Uncaught exception from servlet
com.google.apphosting.runtime.HardDeadlineExceededError: This request (6fb7b7f9d69018c0) started at 2009/05/28 00:55:03.484 UTC and was still executing at 2009/05/28 00:55:32.608 UTC.
	at org.jruby.RubySymbol$SymbolTable.getEntryFromTable(RubySymbol.java:647)
	at org.jruby.RubySymbol$SymbolTable.fastGetSymbol(RubySymbol.java:639)
	at org.jruby.Ruby.fastNewSymbol(Ruby.java:2736)
	at org.jruby.ast.SymbolNode.getSymbol(SymbolNode.java:84)
	at org.jruby.ast.SymbolNode.interpret(SymbolNode.java:89)
	at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
	at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
	at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
	at org.jruby.evaluator.ASTInterpreter.evalClassDefinitionBody(ASTInterpreter.java:196)
	at org.jruby.ast.ClassNode.interpret(ClassNode.java:139)
	at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
	at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
	at org.jruby.evaluator.ASTInterpreter.evalClassDefinitionBody(ASTInterpreter.java:196)
	at org.jruby.ast.ClassNode.interpret(ClassNode.java:139)
	at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
	at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
	at org.jruby.ast.RootNode.interpret(RootNode.java:129)
	at org.jruby.Ruby.loadFile(Ruby.java:2350)
	at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
	at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:572)
	at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:279)
	at org.jruby.runtime.load.LoadService.require(LoadService.java:290)
	at org.jruby.RubyKernel.require(RubyKernel.java:905)
	at ...

なんか、根深そうですね。。とりあえず今日はここまで。