java.io.NotSerializableException: org.mozilla.javascript.ClassCache (somewhat long)

If some one can take a look into this problem, I will appreciate it
greately.

I am trying to serialize simple JS Function.  I do not think it have
much relevance, but function I am trying to serialize looks like this:

function () {
  this.result = this.a + this.b;
  return this.result;
}

This is a snipet of the code which I am using to serialize it.  At this
moment function in question stored in remote_method variable:
....
Scriptable remote_method = ...;
....
 ByteArrayOutputStream baos = new ByteArrayOutputStream();

 ScriptableOutputStream sos = new ScriptableOutputStream( baos, scope
);
 sos.writeObject( remote_method );
 sos.close();
....

This is what I am getting in return:

java.io.NotSerializableException: org.mozilla.javascript.ClassCache
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
        at
org.mozilla.javascript.MemberBox.writeObject(MemberBox.java:289)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
        at
org.mozilla.javascript.ScriptableObject.writeObject(ScriptableObject.java:1887)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
        at
org.mozilla.javascript.ScriptableObject.writeObject(ScriptableObject.java:1887)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
        at
org.mozilla.javascript.ScriptableObject.writeObject(ScriptableObject.java:1872)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
        at
org.mozilla.javascript.ScriptableObject.writeObject(ScriptableObject.java:1872)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
....

One other piece of information, optimization level set to -1.

0
Andrei
3/10/2005 1:15:07 AM
netscape.mozilla.jseng 1530 articles. 0 followers. Follow

3 Replies
453 Views

Similar Articles

[PageSpeed] 20

Using
....
ClassCache.get( scope ).setCachingEnabled( false );
....

did not help a bit.

0
Andrei
3/10/2005 1:38:10 AM
I think I am getting somewhere.  Once I switched to rhino1_6R2pre I am
not getting this exception anymore.  I am not there yet, but at least I
am moving...

0
Andrei
3/10/2005 2:07:58 AM
First, ClassCache is not meant to be serialized - I don't think this will  
change.

Now normally, you pass your top level scope to the ScriptableOutputStream  
constructor, hence it will be stubbed in the stream instead of being  
written out. ClassCache is set as an associated value of the top level  
scope, and top level scope being stubbed out, serialization should never  
reach the ClassCache through it either. So, either you:

a) have another path of references that reaches ClassCache (highly  
unlikely)
b) have an object that was serving as a top level scope previously, and  
you accessed Java objects (hence triggered ClassCache cretion) from code  
using it as a top level scope or (not too likely)
c) are not specifying your top level scope as the argument to  
ScriptableOutputStream constructor (likely).

-- 
home: http://www.szegedi.org
weblog: http://www.jroller.com/page/aszegedi
Visit Szegedi Butterfly fractals at:
   http://www.szegedi.org/fractals/butterfly/index.html

Attila.

On 9 Mar 2005 17:15:07 -0800, Andrei Tchijov <andrei@tchijov.com> wrote:

> If some one can take a look into this problem, I will appreciate it
> greately.
>
> I am trying to serialize simple JS Function.  I do not think it have
> much relevance, but function I am trying to serialize looks like this:
>
> function () {
>   this.result = this.a + this.b;
>   return this.result;
> }
>
> This is a snipet of the code which I am using to serialize it.  At this
> moment function in question stored in remote_method variable:
> ...
> Scriptable remote_method = ...;
> ...
>  ByteArrayOutputStream baos = new ByteArrayOutputStream();
>
>  ScriptableOutputStream sos = new ScriptableOutputStream( baos, scope
> );
>  sos.writeObject( remote_method );
>  sos.close();
> ...
>
> This is what I am getting in return:
>
> java.io.NotSerializableException: org.mozilla.javascript.ClassCache
>         at
....
0
Attila
3/10/2005 5:56:48 PM
Reply:

Similar Artilces:

[RHINO/HTTPUNIT] org.mozilla.javascript.JavaScriptException: java.io.EOFException
Hi, I get the above error messaging during (httpunit-)parsing of the URL : https://portal.intersport.de/irj The stacktrace is: --------------------------------------------------------------------------- org.mozilla.javascript.JavaScriptException: java.io.EOFException at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:70) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:418) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2179) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:58) at...

mozilla-community-brasil@lists.mozilla.org vs community-brasil@lists.mozilla.org
--5p8PegU4iirBW1oA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Eu ainda n=C3=A3o sei porque algumas pessoas manda email para mozilla-community-brasil@lists.mozilla.org quando deveriam enviar email para community-brasil@lists.mozilla.org. O envio de emails para mozilla-community-brasil@lists.mozilla.org e o uso do "responder para todos" faz com que eu e outras pessoas recebam email duplicado pois emails para mozilla-community-brasil@lists.mozilla.org possuem Reply-To: Lista de discuss=C3=A3o...

ftp.mozilla.org/pub/mozilla.org/
ftp.mozilla.org/pub/mozilla.org/ I have used the above ftp in the past. I notice that the Index now shows "addons" and lists numerically the available addons (extensions ?) - Previously they were listed IIRC "extensions". How does one determine WHAT are the contents of the various "directories" eg "ftp://ftp.mozilla.org/pub/addons/17/" = Chromedit...... Any assistance is greatly appreciated.... regards:captjlddavis On 9/28/2007 15:59, captjlddavis wrote: > ftp.mozilla.org/pub/mozilla.org/ > > I have used the above ftp in t...

black screen: http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/
I use the b2g-17.0a1.en-US.mac64.dmg<http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/b2g-17.0a1.en-US.mac64.dmg> and get a black screen emulator. thanks. ...

java.lang.NoClassDefFoundError: org/mozilla/javascript/optimizer/OptRuntime
Hi, I am trying to update catalina.policy file in Tomcat for my web application which uses Rhino. When I enable the Security Manager, it throws an exception as below. Could some one please help me out with this. Using CATALINA_BASE: C:\jakarta-tomcat-5.5.9 Using CATALINA_HOME: C:\jakarta-tomcat-5.5.9 Using CATALINA_TMPDIR: C:\jakarta-tomcat-5.5.9\temp Using JAVA_HOME: C:\jrockit-jdk1.5.0_03 Using Security Manager java.lang.NoClassDefFoundError: org/mozilla/javascript/optimizer/OptRuntime at org.mozilla.javascript.gen.c1._c0(TRN_FinalizeLots.js:1) at org.mozill...

http://ftp.mozilla.org/pub/mozilla.org/ is unavailable
Hi all, http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-1.9.1-l10n/ is unavailable for several days. I can't test recent builds :-( Does anybody can access latest-mozilla-1.9.1-l10n? With best regards, Siarhei It seems now, it is local network problem :-/ �� 27.05.2009 12:57, Siarhei �������(��): > Hi all, > > http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-1.9.1-l10n/ > is unavailable for several days. > > I can't test recent builds :-( > > Does anybody can access latest-mozilla-1.9.1-l...

convert org.mozilla.javascript.NativeArray to java.lang.reflect.Array
Hi, I am getting an array as input to one of the functions in a subclass of ScriptableObject. If I try to pass Object[] as an argument , I get exception. If I give it as Object and then try to see if it is native array and process it , somehow I cant get the actual values out pf it. example of javascript is -- var arr = new Array(); var f = this.getField("lsBox1"); var l = this.getField("txt0"); l.value = "Orig List:"; for (var i = 0; i < f.numItems; i++){ l.value = l.value +"\n"+f.getItemAt(i, false); ...

bonsai.mozilla.org moving / cvs.mozilla.org outage planned
We're planning to move bonsai.mozilla.org to a new machine today. Among other things, the new machine is a lot faster. During the changeover the Mozilla source code cvs repository will be down for a half hour to an hour. The bonsai.mozilla.org web site should be up continuously, and that change will be transparent when the DNS change propogates. At this point, we are planning to take cvs.mozilla.org offline at approximately 8:00pm PDT tonight (Tuesday, September 23) to facilitate moving the bonsai databases to the new server without losing any check-in data. -- Dave Mille...

bonsai-l10n.mozilla.org lxr.mozilla.org interlinking wrong
When I'm on http://bonsai-l10n.mozilla.org/cvslog.cgi?file=l10n/mk/toolkit/defines.inc&rev=&root=/l10n and if I click on any of the links that go to lxr.mozilla.org, it goes to a wrong url of: http://lxr.mozilla.org/l10n/source/l10n/mk/toolkit/defines.inc instead of the correct: http://lxr.mozilla.org/l10n/source/mk/toolkit/defines.inc (notice that the wrong url has one /l10n/ more) Also, on http://lxr.mozilla.org/l10n/source/mk/toolkit/defines.inc the links to "Cvs Log" "Cvs blame" etc. go to the incorrect url of: http://bonsai.mozilla.org/cvslog.cg...

wiki.mozilla.org/B2G/Gaia -> wiki.mozilla.org/Gaia
Hey all, FYI: wiki.mozilla.org/B2G/Gaia has moved to wiki.mozilla.org/Gaia Trond. ...

mozilla.org vs mozilla.com
I did a google search for thunderbird and had mozilla.com coming first in the search results and so I went there and downloaded it. But then I thought wasn't it supposed to be mozilla.org. So I went to mozilla.org also and download a version of thunderbird from there too. Now the two copies of thunderbird for windows setup programs were marked as of the same version (1.5.0.7), but the sizes are different. I wonder what's wrong. If mozilla.com and mozilla.org are both legitimate sites, why did they have to confuse us like this? "emrefan" <dksleung@hotmail.com>...

localize.mozilla.org: Firefox Cup still a project in localize.mozilla.org
As far as I know, the football championship 2010 has ended on 11/07. If somebody missed it, Spain is the champion, beating Netherlands 1:0 a.e.t. Would it not make sense to retire it? Or to cloak it some way? TiA smo PS: SL version was 100% by the time it was needed. the contents have grown since to hard-to-understand 38206 words ("that need your attention", status 0% completed), As far as I can see, changes involve Add-ons and thats where they belong. Thanks, Vito. We are investigating it and will report back with a fix soon. smo wrote: > As far as I k...

ftp://ftp.mozilla.org/pub/mozilla.org/ 550 Permission denied.
Anyone else getting the same? http://www.seamonkey-project.org/releases/ 64bit linux build (near bottom of page) Linux/x86_64 Linux/x86_64 .tar.bz2 (readme) (MD5 sum) (SHA1 sum) tries to link to: ftp://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.33.1/contrib/seamonkey-2.33.1.en-US.linux-x86_64.tar.bz2 but that results in a 550 Permission denied error. Yeah, ftp://ftp.mozilla.org/pub/ doesn't work either. However, I remember reading this newsgroup thread: https://groups.google.com/forum/#!topic/mozilla.general/Jqm5Q1swEnA ... It is after the 5th so ftp.mo...

Mozilla lexicon on wiki.mozilla.org
Hi everyone, The Mozilla lexicon is a new effort to gather and define Mozilla-project specific terms on the Mozilla Wiki. https://wiki.mozilla.org/Lexicon:Home As Mozilla has grown significantly with new employees and active contributors from across the globe, the Contributor Engagement team is gathering project-related terms in one place and will work with interested contributors to define key terms. To be clear, the lexicon will not compete with MDN, which is our platform for technical/web standards documentation. The lexicon will focus on defining non-technical, project-related ...

Web resources about - java.io.NotSerializableException: org.mozilla.javascript.ClassCache (somewhat long) - netscape.mozilla.jseng

Resources last updated: 12/17/2015 4:35:34 PM