Why won't Sinatra work correctly? - ruby-on-rails

I was recently trying to set up an Amazon EC2 instance to run Rails and Sinatra apps. The problem - Sinatra won't start. When I try to run the .rb file, it throws something like this:
$ ruby hello.rb
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1144:in `define_method': tried to create Proc object without a block (ArgumentError)
from /usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1144:in `compile!'
from /usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1129:in `route'
from /usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1111:in `get'
from /usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1474:in `send'
from /usr/local/rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.5/lib/sinatra/base.rb:1474:in `get'
from hello.rb:4
Now, I initially thought that was something specific to EC2. So I set up RVM on my Mac and tried the same - same result. Then I thought it might be a specific version of Ruby being used (1.9.2). It is not - the problem persists even with 1.8.7. Now, I am completely lost. Here is the list of gems currently installed on my EC2 instance:
$ gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (3.0.7)
activemodel (3.0.7)
activerecord (3.0.7)
activeresource (3.0.7)
activesupport (3.0.7)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.12)
coderay (0.9.7)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
method_source (0.4.1)
mime-types (1.16)
polyglot (0.3.1)
pry (0.8.3)
rack (1.2.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.7)
railties (3.0.7)
rainbow (1.1.1)
rake (0.8.7)
ruby_parser (2.0.6)
sexp_processor (3.0.5)
sinatra (1.2.5)
slop (1.5.3)
thor (0.14.6)
tilt (1.3)
treetop (1.4.9)
tzinfo (0.3.27)
Please let me know what you think of that - any help is appreciated.

Looks like it's a bug in sinatra: https://github.com/sinatra/sinatra/issues/258.
As a workaround, try the previous version of sinatra: gem install sinatra -v 1.2.3, either in a new rvm gemset, or specify the version you want in your file with gem 'sinatra' '=1.2.3' before your require sinatra line.
Update:
Sinatra 1.2.5 (the version at fault) has been yanked and a new version released. Anyone getting this error can now just do gem update sinatra and use the updated gem.

It's not a RVM problem, as I use it with Sinatra.
Here's some test code:
#!/usr/bin/env ruby
require 'sinatra'
get '/hi' do
"Hello World! #{ `rvm -v` }"
end
Save that to something like test.rb and do a chmod +x test.rb to make it executable. Confirm you're running Ruby under RVM's control using which ruby, which should return a path in your ~/.rvm path. Run the code using ./test.rb and your RVM controlled Ruby will start it.
The console out:
>> == Sinatra/1.2.3 has taken the stage on 4567 for development with backup from WEBrick
>> [2011-04-30 14:49:56] INFO WEBrick 1.3.1
>> [2011-04-30 14:49:56] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.6.0]
>> [2011-04-30 14:49:56] INFO WEBrick::HTTPServer#start: pid=3387 port=4567
>> 127.0.0.1 - - [30/Apr/2011 14:50:02] "GET /hi HTTP/1.1" 200 103 0.2499
>> localhost - - [30/Apr/2011:14:50:01 MST] "GET /hi HTTP/1.1" 200 103
>> - -> /hi
>> 127.0.0.1 - - [30/Apr/2011 14:50:02] "GET /favicon.ico HTTP/1.1" 404 441 0.0008
>> localhost - - [30/Apr/2011:14:50:02 MST] "GET /favicon.ico HTTP/1.1" 404 441
>> http://localhost:4567/hi -> /favicon.ico
>>
>> == Sinatra has ended his set (crowd applauds)
>> [2011-04-30 14:50:11] INFO going to shutdown ...
>> [2011-04-30 14:50:11] INFO WEBrick::HTTPServer#start done.
And what I saw in my browser:
Hello World! rvm 1.6.5 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]
Changing it to:
get '/hi' do
"<pre>#{ `which ruby` }</pre>"
end
displays this in my browser:
/Users/greg/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
So, basically, I've got RVM running on my system and Ruby 1.9.2 is the current Ruby. Try that code, run it and see if you get output in your browser.
Also see whether your RVM is current. It bumped up to 1.6.5 last week. If you're not current use:
rvm get head
rvm reload
EDIT:
One further test to show which Ruby is running: Change the code to this:
#!/usr/bin/env ruby
require 'sinatra'
get '/hi' do
"Running using: #{RUBY_VERSION}<br>Ruby in path found at: #{ `which ruby` }"
end
and run it. If your interpreter is running the system-installed Ruby on MacOS or the default install for Ruby via apt-get, you'll be on 1.8.7. I get:
Running using: 1.9.2
Ruby in path found at: /Users/greg/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

Related

Installing Rails 3.0.9 on Ubuntu 10.10 with RVM - no rails command in path

This seems similar to a number of other questions posted, but is actually a different problem and with different (newer) versions (hence, the new question).
On a moderately fresh installation of Ubuntu 10.10 Maverik, I attempted to install Rails using RVM as I have done on other distributions before.
Here are roughly the steps I took:
Installed RVM: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Installed a bunch of dependencies using apt-get (curl, zlib-dev, g++, openssl, apache2-dev, libsqlite3-dev, libreadline5-dev)
Installed Ruby: rvm install 1.9.2; rvm use 1.9.2 --default
Installed Passenger (for use with Apache): rvm gem install passenger
Build the Apache Passenger mod: passenger-install-apache2-module
Note that I actually had an unrelated issue here: it failed a dependency check for openssl. I discovered that just executing ruby -e 'require "openssl"' resulted in an error. So, following the instructions I found at http://www.ruby-forum.com/topic/90083#175543 solved the issue in src/ruby-1.9.2-p290/ext/openssl/ and then the passenger module installation succeeded.
Decided to create a gemset for rails3 as I plan to test 3.1 later: rvm use --create 1.9.2#rails3
Installed rails: rvm gem install rails
That all appeared to go without a hitch (save for a couple warnings from the ri and RDoc generation). However, now if I type rails (after new shell login), I just get:
The program 'rails' is currently not installed. You can install it by typing:
apt-get install rails
However, my PATH is:
/usr/local/rvm/gems/ruby-1.9.2-p290#rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290#global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
and rvm info says:
ruby-1.9.2-p290#rails3:
system:
uname: "Linux domU-12-31-39-15-36-1A 2.6.35-24-virtual #42-Ubuntu SMP Thu Dec 2 05:01:52 UTC 2010 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.6.32 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p290"
date: "2011-07-09"
platform: "i686-linux"
patchlevel: "2011-07-09 revision 32553"
full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.2-p290#rails3"
ruby: "/usr/local/rvm/rubies/ruby-1.9.2-p290"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/gem"
rake: "/usr/local/rvm/gems/ruby-1.9.2-p290#global/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.2-p290#rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290#global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.2-p290#rails3"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.2-p290#rails3:/usr/local/rvm/gems/ruby-1.9.2-p290#global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.2-p290"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.2-p290/.irbrc"
RUBYOPT: ""
gemset: "rails3"
So, my question for some Rails/Ruby/Ubuntu Gurus is: what is going on here? If I just need to add something to my PATH to allow bash to find rails, I can't figure out what.
The result of executing find /usr/local/rvm -name rails is:
/usr/local/rvm/src/rvm/scripts/extras/rails
/usr/local/rvm/scripts/extras/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/ruby/shared/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/stub/rails_apps/3.0/empty/script/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/bin/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails/app/templates/script/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionmailer-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/doc/activerecord-3.0.9/rdoc/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/doc/actionmailer-3.0.9/rdoc/lib/rails
But attempting to directly execute /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails just gives:
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rake-0.8.7] (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
(and I have no idea if that is even a reasonable thing to try)
Just in case I've not provided enough information :) - rvm gem list gives:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.9)
actionpack (3.0.9)
activemodel (3.0.9)
activerecord (3.0.9)
activeresource (3.0.9)
activesupport (3.0.9)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.15)
daemon_controller (0.2.6)
erubis (2.6.6)
fastthread (1.0.7)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
passenger (3.0.7)
polyglot (0.3.2)
rack (1.3.2, 1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9)
railties (3.0.9)
rake (0.8.7 ruby)
rdoc (3.9.1)
sqlite3 (1.3.4)
sqlite3-ruby (1.3.3)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.29)
Any help or pointers greatly appreciated. Meanwhile I'll continue to bang my head on it.
use gem install rails instead of rvm gem install rails

ubuntu ruby on rails installation

I installed RoR on ubuntu 10, using all kinds so method i could find on internet, either "sudo apt-get" or "sudo gem install", by running 'gem list', i can see they are all the latest version:
*** LOCAL GEMS ***
actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
fastthread (1.0.7)
mysql (2.8.1)
passenger (2.2.15)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
rubygems-update (1.3.7)
but when i created a ror application by running 'rails samplecode', then run 'script/about', it always showed:
About your application's environment
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.5
Rails version 2.2.3
Active Record version 2.2.3
Action Pack version 2.2.3
Active Resource version 2.2.3
Action Mailer version 2.2.3
Active Support version 2.2.3
Edge Rails revision unknown
Application root /home/kc/Projects/samplecode
Environment development
Database adapter mysql
why these 2 settings are different? how can i force the application to use the local gems (latest version)? Thanks.
Ubuntu (aptitude/apt-get) installs gems in /var/lib/gems/1.8. When you run gem install manually, you're likely installing them in /usr/lib/ruby/gems/1.8.
Run "gem env" and look at what the gem path(s) is/are.
If you set the GEM_HOME environment variable (GEM_HOME=/usr/lib/ruby/gems/1.8), you can have you application look there.
Alternately, you can install the gems you want (including rails) in your application's vendor directory by putting config.gem lines in environment.rb and running rake gems:unpack:dependencies.
Uninstall the apt-get version of Rails:
sudo apt-get remove rails
And then install Rails again using gem:
sudo gem install rails

deployment for jruby on rails app

I am trying to deploy a jruby on rails application.
Right now I am running mongrel + Apache2 using reverse proxy from mod_proxy. However, because mongrel_jcluster does not work for the latest versions of jruby, I am only able to run one mongrel server, and cant take advantage of load balancing from apache2.
Is there any way other way to create a mongrel cluster? I'd really prefer mongrel cluster + apache2 to a java servlet type system.
I've tried jetty using the instructions here: http://jetty-rails.rubyforge.org/
but I get the following error when starting up the jetty server, even though I've checked my activerecord-jdbcmysql-adapter gem version under jruby and its there and version 0.9.7
DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from /home/andrew/.gem/jruby/1.8/gems/activesupport-2.3.8/lib/activesupport.rb:2)
2010-07-20 17:00:46.820::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
Starting server 3000
2010-07-20 17:00:47.134::INFO: jetty-6.1.14
2010-07-20 17:01:03.511:/:INFO: Info: using runtime pool timeout of 30 seconds
2010-07-20 17:01:03.511:/:INFO: Info: received min runtimes = 1
2010-07-20 17:01:03.511:/:INFO: Info: received max runtimes = 5
Loading parser from serialized file lib/stanford-parser/englishPCFG.ser.gz ... done [4.6 sec].
2010-07-20 17:01:14.341:/:WARN: Error: unable to initialize application
org.jruby.rack.RackInitializationException: Please install the jdbcmysql adapter: `gem install activerecord-jdbcmysql-adapter` (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)
any suggestions would be appreciated, thanks!
EDIT: I don't know if this makes a difference, but I am able to tell that before it crashes, jetty_rails successfully loads a global variable declared in the environment.rb
EDIT: here is my full gem list from jruby -S gem list --local
*** LOCAL GEMS ***
actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activerecord-jdbc-adapter (0.9.7)
activerecord-jdbcmysql-adapter (0.9.7)
activeresource (2.3.8)
activesupport (2.3.8)
builder (2.1.2)
gem_plugin (0.2.3)
jdbc-mysql (5.0.4)
jetty-rails (0.8.1)
jruby-jars (1.5.1)
jruby-openssl (0.7)
jruby-rack (1.0.1)
mizuno (0.3.6)
mongrel (1.1.5)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
rubyzip (0.9.4)
sources (0.0.1)
warbler (1.1.0)
Maybe you're switching between multiple ruby interpreters (via RVM or manually). Make sure
that you have 2.3.8 gems for rails and it's dependencies by running "gem list" using Jruby.
If you don't have the gems under Jruby, run "gem install -v=2.3.8 rails".
You could pack the rails gems inside the project tree by running "rake rails:freeze:gems".
The only possible answer that I know is that you have two ruby interpreters on the system, and the one being picked up by the jetty environment is missing gems. Does ruby -v give you a different answer than jruby -v?
That being said, is there a reason why you don't want to use warble and deploy a war to Jetty or Tomcat? I find that works well.

rvm conflit with sqlite3

$: /Users/dev/.rvm/gems/ruby-1.9.2-head#rails3/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Abort trap
It's seem that ruby is not the correct version (1.8.7) but :
$: ruby - v
$: ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]
$: gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta4, 3.0.0.beta3)
actionpack (3.0.0.beta4, 3.0.0.beta3)
activemodel (3.0.0.beta4, 3.0.0.beta3)
activerecord (3.0.0.beta4, 3.0.0.beta3)
activeresource (3.0.0.beta4, 3.0.0.beta3)
activesupport (3.0.0.beta4, 3.0.0.beta3)
arel (0.4.0, 0.3.3)
builder (2.1.2)
bundler (0.9.26)
erubis (2.6.6)
i18n (0.4.1, 0.3.7)
mail (2.2.5)
memcache-client (1.8.5)
mime-types (1.16)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.9)
rack-test (0.5.4)
rails (3.0.0.beta4, 3.0.0.beta3)
railties (3.0.0.beta4, 3.0.0.beta3)
rake (0.8.7)
rdoc (2.5.9)
sqlite3-ruby (1.3.1)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.8)
treetop (1.4.8)
tzinfo (0.3.22)
will_paginate (3.0.pre)
more info :
$: ~ dev$ ruby -v
ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]
$ :~ dev$ rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
Any ideas ?
Thanks very much :)
Had the same issue after moving to 1.9.2p0, but restarting the console on Snow Leopard did the trick. Seems rvm might have gotten confused.
Same problem for me on Snow Leopard; even though under rvm 1.9.2#rails3, I can see correct rails version number.
I have to use following command to use rails command:
ruby which rails g scaffold User name:string bio:text
Any solution?
I've finally found the reason. Looks like gem install rails is not managed to install the proper binary for rails in rvm. And rails is still references /usr/bin/rails, which have a #! line point to System ruby.
You can see it with:
head -1 `which rails`
which returns:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Change that to:
#!/usr/bin/env ruby
will fix the problem. I don't know if this problem affect other executable scripts gem installs, but why gem not install rails to rvm's own bin path is a mystery to me. Anyway, this workaround do the dirty for me.
I Had the same problem when using ree-1.8.7-2011.03. (Ruby enterprise Edition)
I uninstalled the sqlite3 gems then I ran:
gem install sqlite3
and it worked. Note that the sqlite3-ruby gem now recommends to use 'sqlite3' now.
I don't know how this has happened in your case but it looks to me that Rails has tried to run with your system installed Ruby but is loading gems from a 1.9.2 load path. Very odd.
You see the correct Ruby version in your shell (RVM has precedence in the local path) but that's not apparently what Rails is being started with.
Check to see you how you are starting Rails and that you don't have paths or links or aliases messed up between Ruby versions
You might need to run
rvm reload
Same problem after a bunch of updates (rvm to 1.5.2 and ruby to 1.9.2-p180)
Console restart did not work for me, updating to rails 3.0.6 changed the error to a seg error of mysql2 instead of sqlite3, re-installing mysql2 did the trick for me finally.
Regards
Michael
I encountered this exact error in zsh and MacVim, and eventually tracked it back to this RVM issue. The solution was to move the RVM sourcing I had in .zshrc to .zshenv. Worked immediately. Just posting on the off chance someone stumbles across this the way I did.
There is a known issue with zsh, rvm and vim.
The latest solution is to set the shell to sh in your .vimrc
set shell=sh
This blog has all the solutions listed

Impossible to do POSTs with appengine-jruby/RoR: Reflection is not allowed

I'm trying to build a site with RoR on Google App Engine. I'm using the google-appengine gem (http://appengine-jruby.googlecode.com) and following the instructions in (http://gist.github.com/268192). The problem is that I can't submit ANY form!
I've already tried this in two diferent clean Win 7 Pro envs and the result is the same.
After install Ruby 1.8.6 (One-Click Installer):
1. gem update --system
2. gem install rails
3. gem install google-appengine
4. gem install rails_dm_datastore
5. gem install activerecord-nulldb-adapter
6. curl -O http://appengine-jruby.googlecode.com/hg/demos/rails2/rails2_appengine.rb
7. ruby rails2_appengine.rb (previously downloaded)
8. rails myproj
9. chmod myproj
10. ruby script/generate dd_model MyModel f1:string f2:float f3:float f4:float f5:integer f6:integer f7:integer -f
11. ruby script/generate scaffold MyModel f1:string f2:float f3:float f4:float f5:integer f6:integer f7:integer -f --skip-migration
12. dev_appserver.rb -p 3000 .
At this point, I manually test the scaffold in (http://localhost:3000/my_models). The index is OK, then I create a new registry with the generated form, everything's fine, but when I try to create a second one, I get a "java.lang.RuntimeException: DummyDynamicScope should never be used for backref storage" in the console.
As far as I read this is a won't-fix behavior in JRuby 1.4.1, but it's converted to a debug only warning in 1.5.0, so I proceed to install the pre release.
13. gem install appengine-jruby-jars --pre
With this, that exception is solved and everything works great... until I move the project to the GAE server.
14. ruby appcfg.rb update .
And now, in (http://myproj.appspot.com/my_models), again, the index is fine, also the new form, but in the moment that I submit it with valid data, I get a 500 error: "java.lang.IllegalAccessException: Reflection is not allowed on public int".
As I said, this behavior is not present in the local SDK.
In both cases, I'm completely unable to post anything.
This is what I have right now in the GAE environment:
Ruby version 1.8.7 (java)
RubyGems disabled
Rack version 1.1
Rails version 2.3.5
Action Pack version 2.3.5
Active Support version 2.3.5
DataMapper version 0.10.2
Environment production
JRuby Runtime version 1.5.0.pre
JRuby-Rack version 0.9.7
AppEngine SDK version Google App Engine/1.3.3
AppEngine APIs version 0.0.15
And this are my intalled gems:
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activerecord-nulldb-adapter (0.2.0)
activeresource (2.3.5)
activesupport (2.3.5)
addressable (2.1.2)
appengine-apis (0.0.15)
appengine-jruby-jars (0.0.8.pre, 0.0.7)
appengine-rack (0.0.8)
appengine-sdk (1.3.3.1)
appengine-tools (0.0.12)
bundler08 (0.8.5)
dm-appengine (0.0.8)
dm-ar-finders (0.10.2)
dm-core (0.10.2)
dm-timestamps (0.10.2)
dm-validations (0.10.2)
extlib (0.9.14)
fxri (0.3.7, 0.3.6)
google-appengine (0.0.12)
hpricot (0.8.2 x86-mswin32, 0.6 mswin32)
jruby-rack (0.9.8, 0.9.7)
log4r (1.1.7, 1.0.5)
rack (1.1.0, 1.0.1)
rails (2.3.5)
rails_appengine (0.0.3)
rails_dm_datastore (0.2.9)
rake (0.8.7, 0.7.3)
rubygems-update (1.3.7, 1.3.6)
rubyzip (0.9.4)
sources (0.0.1)
win32-api (1.4.6 x86-mswin32-60, 1.0.4 mswin32)
win32-clipboard (0.5.2, 0.4.3)
win32-dir (0.3.6, 0.3.2)
win32-eventlog (0.5.2, 0.4.6)
win32-file (0.6.3, 0.5.4)
win32-file-stat (1.3.4, 1.2.7)
win32-process (0.6.2, 0.5.3)
win32-sapi (0.1.5, 0.1.4)
win32-sound (0.4.2, 0.4.1)
windows-api (0.4.0, 0.2.0)
windows-pr (1.0.9, 0.7.2)
I'm unable to attach the full logs of the exceptions because of the character limits, but I can provide them under request. Here's an abstract of them:
DummyDynamicScope (dev and prod envs):
14-may-2010 7:18:40 com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: [1273821520195000] javax.servlet.ServletContext log: Application Error
java.lang.RuntimeException: DummyDynamicScope should never be used for backref storage
at org.jruby.runtime.scope.DummyDynamicScope.getBackRef(DummyDynamicScope.java:49)
at org.jruby.RubyRegexp.updateBackRef(RubyRegexp.java:1404)
at org.jruby.RubyRegexp.updateBackRef(RubyRegexp.java:1396)
at org.jruby.RubyRegexp.search(RubyRegexp.java:1386)
at org.jruby.RubyRegexp.op_match(RubyRegexp.java:1301)
at org.jruby.RubyString.op_match(RubyString.java:1446)
at org.jruby.RubyString$i_method_1_0$RUBYINVOKER$op_match.call(org/jruby/RubyString$i_method_1_0$RUBYINVOKER$op_match.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrN.call(JavaMethod.java:721)
at org.jruby.RubyClass.finvoke(RubyClass.java:472)
at org.jruby.RubyObject.send(RubyObject.java:1442)
at org.jruby.RubyObject$i_method_multi$RUBYINVOKER$send.call(org/jruby/RubyObject$i_method_multi$RUBYINVOKER$send.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrNBlock.call(JavaMethod.java:276)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:330)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:189)
at ruby.jit.ruby.C_3a_.Desarrollo.AppEngine.gorgory.WEB_minus_INF.lib.gems_dot_jar.bundler_gems.jruby.$1_dot_8.gems.dm_minus_validations_minus_0_dot_10_dot_2.lib.dm_minus_validations.validators.numeric_validator.validate_with_comparison
at ruby.jit.ruby.C_3a_.Desarrollo.AppEngine.gorgory.WEB_minus_INF.lib.gems_dot_jar.bundler_gems.jruby.$1_dot_8.gems.dm_minus_validations_minus_0_dot_10_dot_2.lib.dm_minus_validations.validators.numeric_validator.validate_with_comparison
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:102)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:280)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:69)
at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:229)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:193)
at org.jruby.RubyClass.finvoke(RubyClass.java:491)
at org.jruby.RubyObject.send(RubyObject.java:1448)
at org.jruby.RubyObject$i_method_multi$RUBYINVOKER$send.call(org/jruby/RubyObject$i_method_multi$RUBYINVOKER$send.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrThreeOrNBlock.call(JavaMethod.java:293)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:350)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:229)
at ruby.jit.ruby.C_3a_.Desarrollo.AppEngine.gorgory.WEB_minus_INF.lib.gems_dot_jar.bundler_gems.jruby.$1_dot_8.gems.dm_minus_validations_minus_0_dot_10_dot_2.lib.dm_minus_validations.validators.numeric_validator.validate_with28985350_50
at ruby.jit.ruby.C_3a_.Desarrollo.AppEngine.gorgory.WEB_minus_INF.lib.gems_dot_jar.bundler_gems.jruby.$1_dot_8.gems.dm_minus_validations_minus_0_dot_10_dot_2.lib.dm_minus_validations.validators.numeric_validator.validate_with28985350_50
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:201)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:227)
at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
Reflection (only prod env):
Java::JavaLang::SecurityException (java.lang.IllegalAccessException: Reflection is not allowed on public int java.lang.String$CaseInsensitiveComparator.compare(java.lang.String,java.lang.String)):
com.google.appengine.runtime.Request.process-92563a0605f433ea(Request.java)
java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:40)
org.jruby.javasupport.JavaMethod.<init>(JavaMethod.java:176)
org.jruby.javasupport.JavaMethod.create(JavaMethod.java:183)
org.jruby.java.invokers.MethodInvoker.createCallable(MethodInvoker.java:23)
org.jruby.java.invokers.RubyToJavaInvoker.<init>(RubyToJavaInvoker.java:63)
org.jruby.java.invokers.MethodInvoker.<init>(MethodInvoker.java:13)
org.jruby.java.invokers.InstanceMethodInvoker.<init>(InstanceMethodInvoker.java:15)
org.jruby.javasupport.JavaClass$InstanceMethodInvokerInstaller.install(JavaClass.java:339)
org.jruby.javasupport.JavaClass.installClassMethods(JavaClass.java:723)
org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:586)
org.jruby.javasupport.Java.createProxyClass(Java.java:506)
org.jruby.javasupport.Java.getProxyClass(Java.java:445)
org.jruby.javasupport.Java.getInstance(Java.java:354)
org.jruby.javasupport.JavaUtil.convertJavaToUsableRubyObject(JavaUtil.java:143)
org.jruby.javasupport.JavaClass$ConstantField.install(JavaClass.java:360)
org.jruby.javasupport.JavaClass.installClassFields(JavaClass.java:711)
org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:585)
org.jruby.javasupport.Java.createProxyClass(Java.java:506)
org.jruby.javasupport.Java.getProxyClass(Java.java:445)
org.jruby.javasupport.Java.getProxyOrPackageUnderPackage(Java.java:885)
org.jruby.javasupport.Java.get_proxy_or_package_under_package(Java.java:918)
org.jruby.javasupport.JavaUtilities.get_proxy_or_package_under_package(JavaUtilities.java:54)
org.jruby.javasupport.JavaUtilities$s_method_2_0$RUBYINVOKER$get_proxy_or_package_under_package.call(org/jruby/javasupport/JavaUtilities$s_method_2_0$RUBYINVOKER$get_proxy_or_package_under_package.gen:65535)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:329)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:188)
org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:138)
org.jruby.javasupport.util.RuntimeHelpers$MethodMissingMethod.call(RuntimeHelpers.java:389)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:182)
What should I do now? Any hint would be wellcome. Thanks!
It's not a problem with anything you're doing. There's something going on internally in the jruby-jars that is in the process of being fixed.

Resources