[Biojava-l] serializing a SimpleSequence? "NoSuchFieldException: DEFAULT"
Schreiber, Mark
mark.schreiber@agresearch.co.nz
Wed, 10 Jul 2002 11:48:16 +1200
Hi -
What version of biojava are you using. You may need to 'upgrade' to the
biojava-live version. There has been some not insignificant issues with
serialization in biojava. We managed to nail a lot of them at the last
bootcamp and I'm pretty sure that serializing a sequence works ok know.
Take a look at SeqSerializationTest.java in the tests directory of the
CVS tree. The test sequence does have features and this test seems to
work for me now so possibly you have an older version (which definitely
didn't work).
- Mark
> -----Original Message-----
> From: Paul Shannon [mailto:pshannon@systemsbiology.org]
> Sent: Wednesday, 10 July 2002 11:39 a.m.
> To: biojava-l@biojava.org
> Subject: [Biojava-l] serializing a SimpleSequence?
> "NoSuchFieldException: DEFAULT"
>
>
> I'd like to write a org.biojava.bio.seq.Sequence to an RMI
> server, for which of course it needs to be serializable.
> After first encountering difficulty, I removed the RMI code,
> replacing it with a couple of lines that try to write fasta
> sequences, serialized, to a file. The same exception happens there.
>
>
>
> BufferedReader br = new BufferedReader (new FileReader
> (fileName));
> SequenceIterator seqIter = SeqIOTools.readFastaDNA (br);
>
> FileOutputStream out = new FileOutputStream ("seq.bin");
> ObjectOutputStream s = new ObjectOutputStream (out);
>
> while (seqIter.hasNext()) {
> Sequence seq = seqIter.nextSequence ();
> s.writeObject (seq); // line 27
> }
>
>
>
>
> The full text of the exception:
>
> Exception in thread "main" java.lang.NoSuchFieldException: DEFAULT
> at java.lang.Class.getField0(Class.java:1721)
> at java.lang.Class.getField(Class.java:889)
> at
> org.biojava.bio.seq.impl.FeatureImpl$1.writeReplace(FeatureImp
l.java:57)
> rethrown as org.biojava.bio.BioError
> at
> org.biojava.bio.seq.impl.FeatureImpl$1.writeReplace(FeatureImp
l.java:59)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass
> .java:867)
> at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStre
am.java:1330)
> at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.
> java:1302)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStr
eam.java:1245)
> at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
> at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
> at go.main(go.java:27)
>
> I admit to being quite confused about how and when concrete
> classes are created for interfaces. I see that
> seqIter.nextSequence () actually returns a SimpleSequence in
> the while loop above, but I do not know when and how that
> choice is made.
> I guess that is not at issue here.
>
> Instead, the problem may have something to do with this line
> in the first SimpleSequence constructor:
>
> this.featureRealizer = FeatureImpl.DEFAULT;
>
> but that's just a guess.
>
> Can anyone help me out here?
>
> Many thanks!
>
> - Paul Shannon
>
>
> _______________________________________________
> Biojava-l mailing list - Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l
>
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================