JRuby Google App Engine throws sun.misc.Unsafe is a restricted class for new Rails App

207 views Asked by At

I'm trying to get a new JRuby Rails Application to run on Google App Engine. I keep getting a sun.misc.Unsafe is a restricted class error when I try to run it.

Does anyone know what is causing this?

The code is here: https://github.com/feinbergscott/test_jruby_app

Dec 13, 2013 5:24:37 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed /Users/scottfeinberg/projects/test_jruby_app/war/WEB-INF/appengine-web.xml Executing [/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java, -XstartOnFirstThread, -javaagent:/Users/scottfeinberg/projects/appengine-java-sdk/lib/agent/appengine-agent.jar, -Xbootclasspath/p:/Users/scottfeinberg/projects/appengine-java-sdk/lib/override/appengine-dev-jdk-overrides.jar, -classpath, /Users/scottfeinberg/projects/appengine-java-sdk/bin/../lib/appengine-tools-api.jar, com.google.appengine.tools.development.DevAppServerMain, --property=kickstart.user.dir=/Users/scottfeinberg/projects, /Users/scottfeinberg/projects/test_jruby_app/war] objc[24836]: Class JavaLaunchHelper is implemented in both /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java and /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Dec 13, 2013 5:24:40 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed /Users/scottfeinberg/projects/test_jruby_app/war/WEB-INF/appengine-web.xml 2013-12-13 17:24:40.564:INFO::Logging to STDERR via org.mortbay.log.StdErrLog Dec 13, 2013 5:24:40 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed /Users/scottfeinberg/projects/test_jruby_app/war/WEB-INF/web.xml 2013-12-13 17:24:41.147:INFO::jetty-6.1.x Dec 13, 2013 5:24:42 PM com.google.appengine.tools.development.ApiProxyLocalImpl log INFO: javax.servlet.ServletContext log: INFO: jruby 1.7.9 (2.0.0p195) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64] Dec 13, 2013 5:24:42 PM com.google.appengine.tools.development.ApiProxyLocalImpl log INFO: javax.servlet.ServletContext log: INFO: using a shared (threadsafe!) runtime 2013-12-13 17:24:42.609:WARN::failed com.google.appengine.tools.development.DevAppEngineWebAppContext@1a4d101a{/,/Users/scottfeinberg/projects/test_jruby_app/war}: java.lang.NoClassDefFoundError: sun.misc.Unsafe is a restricted class. Please see the Google App Engine developer's guide for more details. 2013-12-13 17:24:42.609:WARN::failed JettyContainerService$ApiProxyHandler@395c2873: java.lang.NoClassDefFoundError: sun.misc.Unsafe is a restricted class. Please see the Google App Engine developer's guide for more details. 2013-12-13 17:24:42.609:WARN::Error starting handlers java.lang.NoClassDefFoundError: sun.misc.Unsafe is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) at org.jruby.RubyEncoding.<clinit>(RubyEncoding.java:203) at org.jruby.RubyThread$Status.<init>(RubyThread.java:143) at org.jruby.RubyThread$Status.<clinit>(RubyThread.java:138) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.lang.Class.getEnumConstantsShared(Class.java:3046) at java.lang.System$2.getEnumConstantsShared(System.java:1189) at java.util.EnumMap.getKeyUniverse(EnumMap.java:750) at java.util.EnumMap.<init>(EnumMap.java:137) at org.jruby.Ruby.<init>(Ruby.java:4789) at org.jruby.Ruby.newInstance(Ruby.java:277) at org.jruby.rack.DefaultRackApplicationFactory.newRuntime(DefaultRackApplicationFactory.java:334) at org.jruby.rack.DefaultRackApplicationFactory$RackApplicationImpl.<init>(DefaultRackApplicationFactory.java:430) at org.jruby.rack.DefaultRackApplicationFactory.createApplication(DefaultRackApplicationFactory.java:418) at org.jruby.rack.DefaultRackApplicationFactory.newApplication(DefaultRackApplicationFactory.java:98) at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:112) at org.jruby.rack.SharedRackApplicationFactory.doInit(SharedRackApplicationFactory.java:31) at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:94) at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50) at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:249) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:306) at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26) at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:79) at com.google.appengine.tools.development.Modules.startup(Modules.java:88) at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:254) at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47) at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:212) at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:210) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:210) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:277) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:219) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:210) 2013-12-13 17:24:42.641:INFO::Started [email protected]:8080 Dec 13, 2013 5:24:42 PM com.google.appengine.tools.development.AbstractModule startup INFO: Module instance default is running at http://localhost:8080/ Dec 13, 2013 5:24:42 PM com.google.appengine.tools.development.AbstractModule startup INFO: The admin console is running at http://localhost:8080/_ah/admin Dec 13, 2013 5:24:42 PM com.google.appengine.tools.development.DevAppServerImpl doStart INFO: Dev App Server is now running

1

There are 1 answers

0
Scott Feinberg On

Turns out this is a JRuby 1.7.9 specific issue. This error does not occur in JRuby 1.7.6