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

Posted by Joel Cuevas on Stack Overflow See other posts from Stack Overflow or by Joel Cuevas
Published on 2010-05-14T18:59:02Z Indexed on 2010/05/14 19:04 UTC
Read the original article Hit count: 562

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!

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about jruby