Rhino serialization example does not work

245 views
Skip to first unread message

Jun Kato

unread,
Oct 18, 2013, 12:23:47 AM10/18/13
to
Hi,

I tried to run this example but got some exceptions.
https://developer.mozilla.org/en-US/docs/Rhino/Serialization

Serialization went well.

js> function f() { return 3; }
js> f()
3
js> serialize(f, "test.ser")

Deserialization failed. Any thoughts?

js> deserialize("f.ser")
org.mozilla.javascript.WrappedException: Wrapped java.lang.ClassNotFoundException: org.mozilla.javascript.gen._stdin__1
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
at org.mozilla.javascript.gen._stdin__6._c_script_0(Unknown Source)
at org.mozilla.javascript.gen._stdin__6.call(Unknown Source)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.gen._stdin__6.call(Unknown Source)
at org.mozilla.javascript.gen._stdin__6.exec(Unknown Source)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:502)
at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:178)
at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:102)
at org.mozilla.javascript.Context.call(Context.java:489)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:160)
at org.mozilla.javascript.tools.shell.Main.main(Main.java:138)
Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.gen._stdin__3
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:623)
at org.mozilla.javascript.serialize.ScriptableInputStream.resolveClass(ScriptableInputStream.java:56)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at org.mozilla.javascript.tools.shell.Global.deserialize(Global.java:363)
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 org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
... 15 more


J
Reply all
Reply to author
Forward
0 new messages