I'm bumping this because for a while I've been using JSON but I've run
into some problems serializing Rhino JS -> Java types.

Please, can someone tell me how to get around this permission error?

On Jul 1, 2:14 pm, Toby Reyelts <[email protected]> wrote:
> App Engine applications don't have the Java
> permission, SerializablePermission enableSubstitution, which is apparently
> what ScriptableOutputStream is taking advantage of. Maybe you can use some
> form of JSON-based serialization as a workaround?
>
> On Wed, Jul 1, 2009 at 5:06 PM, Abe Parvand <[email protected]> wrote:
>
> > The rhino documentation says that in order to serialize an object
> > passed from javascript, we can do:
>
> >                        Scriptable obj = ...
>
> >                        ByteArrayOutputStream bs = new
> > ByteArrayOutputStream();
> >                        ScriptableOutputStream out = new
> > ScriptableOutputStream(bs, scope);
> >                        out.writeObject(obj);
>
> >                        Blob blobToSave = new Blob(bs.toByteArray());
> >                        // do something with blob
>
> >                        bs.close();
> >                        out.close();
>
> > However, when I try this I get a security exception, presumably
> > because there is some file access operation not being permitted by
> > appengine. Anyone know how to serialize objects using rhino under
> > appengine?
>
> >  Here is the error dump:
>
> > Uncaught exception from servlet
> > java.security.AccessControlException: access denied
> > (java.io.SerializablePermission enableSubstitution)
> >        at java.security.AccessControlContext.checkPermission(Unknown
> > Source)
> >        at java.security.AccessController.checkPermission(Unknown Source)
> >        at java.lang.SecurityManager.checkPermission(Unknown Source)
> >        at java.io.ObjectOutputStream.enableReplaceObject(Unknown Source)
> >        at org.mozilla.javascript.serialize.ScriptableOutputStream.<init>
> > (ScriptableOutputStream.java:84)
> >        at
> > com.todoroo.service.impl.JavaScriptManagerImpl.saveActionPlanState
> > (JavaScriptManagerImpl.java:167)
> >        at
> > com.todoroo.service.impl.JavaScriptManagerImpl.callActionPlanTransitionFn
> > (JavaScriptManagerImpl.java:123)
> >        at
> > com.todoroo.service.impl.JavaScriptManagerImpl.callActionPlanForFirstTime
> > (JavaScriptManagerImpl.java:116)
> >        at com.todoroo.server.cron.ESVBibleReaderRandomReminderCron.doGet
> > (ESVBibleReaderRandomReminderCron.java:73)
> >        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> >        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> >        at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > 487)
> >        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > (ServletHandler.java:1093)
> >        at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
> > (SaveSessionFilter.java:35)
> >        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > (ServletHandler.java:1084)
> >        at
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
> > (TransactionCleanupFilter.java:43)
> >        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > (ServletHandler.java:1084)
> >        at org.mortbay.jetty.servlet.ServletHandler.handle
> > (ServletHandler.java:360)
> >        at org.mortbay.jetty.security.SecurityHandler.handle
> > (SecurityHandler.java:216)
> >        at org.mortbay.jetty.servlet.SessionHandler.handle
> > (SessionHandler.java:181)
> >        at org.mortbay.jetty.handler.ContextHandler.handle
> > (ContextHandler.java:712)
> >        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > 405)
> >        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
> > (AppVersionHandlerMap.java:237)
> >        at org.mortbay.jetty.handler.HandlerWrapper.handle
> > (HandlerWrapper.java:139)
> >        at org.mortbay.jetty.Server.handle(Server.java:313)
> >        at
> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > 506)
> >        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
> > (HttpConnection.java:830)
> >        at
> > com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
> > (RpcRequestParser.java:76)
> >        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> >        at
>
> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
> > (JettyServletEngineAdapter.java:125)
> >        at com.google.apphosting.runtime.JavaRuntime.handleRequest
> > (JavaRuntime.java:235)
> >        at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:4755)
> >        at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:4753)
> >        at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
> > (BlockingApplicationHandler.java:24)
> >        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
> > 359)
> >        at com.google.net.rpc.impl.Server$2.run(Server.java:800)
> >        at com.google.tracing.LocalTraceSpanRunnable.run
> > (LocalTraceSpanRunnable.java:56)
> >        at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
> > (LocalTraceSpanBuilder.java:510)
> >        at com.google.net.rpc.impl.Server.startRpc(Server.java:756)
> >        at com.google.net.rpc.impl.Server.processRequest(Server.java:348)
> >        at com.google.net.rpc.impl.ServerConnection.messageReceived
> > (ServerConnection.java:459)
> >        at com.google.net.rpc.impl.RpcConnection.parseMessages
> > (RpcConnection.java:319)
> >        at com.google.net.rpc.impl.RpcConnection.dataReceived
> > (RpcConnection.java:290)
> >        at com.google.net.async.Connection.handleReadEvent(Connection.java:
> > 419)
> >        at com.google.net.async.EventDispatcher.processNetworkEvents
> > (EventDispatcher.java:762)
> >        at com.google.net.async.EventDispatcher.internalLoop
> > (EventDispatcher.java:207)
> >        at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
> > 101)
> >        at com.google.net.rpc.RpcService.runUntilServerShutdown
> > (RpcService.java:251)
> >        at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
> > (JavaRuntime.java:373)
> >        at java.lang.Thread.run(Unknown Source)
>
> > Unexpected exception from servlet:
> > java.security.AccessControlException: access denied
> > (java.io.SerializablePermission enableSubstitution)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to