Sorry to not have a definitive answer (someone would need to try it out),
but I think that if you don't call the super.clone() in the subclass
clone() impl the type will not allowed to be "portable" in the terracotta
sense. It TC does complaint, you could of course just insert a call to
super.clone() and discard the return value, but that is doesn't leave a
pleasant taste in my mouth :-) 



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:tc-dev-
> [EMAIL PROTECTED] On Behalf Of Alex Miller
> Sent: Tuesday, October 07, 2008 12:28 PM
> To: tc-dev@lists.terracotta.org
> Cc: Paul Chan
> Subject: Re: [tc-dev] ClassCastException when writing to index writer
> onLucene list
> 
> I believe if you avoid calling super.clone() and just build the object
> yourself, that would work:
> 
> public Object clone() {
>       SegmentInfos a = new SegmentInfos();
>       // set fields of a
>       return a;
> }
> 
> 
> 
> On Oct 7, 2008, at 2:20 PM, Orion Letizi wrote:
> 
> > I'm not sure.  Does someone on the list know if there's a workaround
> > for CDV-703?
> >
> > --Orion
> >
> >
> > On Oct 7, 2008, at 11:51 AM, Paul Chan wrote:
> >
> >> Hi Orion,
> >>
> >> Yes...This looks like the problem I am seeing when I tried to
> >> integrated Compass (with Lucene 2.3.2) with Terracotta.  Basically
> >> Lucene has a class named SegmentInfos:
> >>
> >> final class SegmentInfos extends Vector
> >> {
> >>   public Object clone()
> >>   {
> >>      SegmentInfos a = (SegmentInfos)super.clone();
> >>      ....
> >>      return a;
> >>   }
> >> }
> >>
> >> super.clone() always returns an object of type Vector instead of
> >> SgementInfos.  This explains the ClassCastExeception that I am
> >> seeing.  Now,  Taylor Gautier from Terracotta suggested that I
> >> removed the following from my tc-config.xml file:
> >> <include>
> >> <class-expression>*..*</class-expression>
> >> </include>
> >>
> >> <!-- Exclude tomcat internals to improve performance of webapp
> >> loading -->
> >>
> >>
> >> <exclude>org.apache.coyote..*</exclude>
> >> <exclude>org.apache.catalina..*</exclude>
> >> <exclude>org.apache.jasper..*</exclude>
> >> <exclude>org.apache.tomcat..*</exclude>
> >>
> >>
> >> </instrumented-classes>
> >>
> >> If I remove the above configuration then I didn't get an exception
> >> when I tried to insert an element into the index, but I don't think
> >> anything is inserted into Terracotta though just by looking at the
> >> Admin Console.
> >>
> >> The JIRA mentions work around or a fix...what is it?
> >>
> >> Thanks!
> >>
> >> Paul
> >>
> >> On Tue, Oct 7, 2008 at 2:01 PM, Orion Letizi <[EMAIL PROTECTED]>
> >> wrote:
> >> Paul,
> >>
> >> I saw your post about a ClassCastException on the Lucene mailing
> >> list:
> >>
> >> http://mail-archives.apache.org/mod_mbox/lucene-java-
>
user/200810.mbox/[EMAIL PROTECTED]
> l.com%3e
> >>
> >> Alex Miller pointed out that it looks something like this:
> >>
> >> http://jira.terracotta.org/jira/browse/CDV-703
> >>
> >> Does that look like the problem you're seeing?
> >>
> >> Cheers,
> >> Orion
> >>
> >>
> >>
> >>
> >
> > _______________________________________________
> > tc-dev mailing list
> > tc-dev@lists.terracotta.org
> > http://lists.terracotta.org/mailman/listinfo/tc-dev
> 
> _______________________________________________
> tc-dev mailing list
> tc-dev@lists.terracotta.org
> http://lists.terracotta.org/mailman/listinfo/tc-dev
_______________________________________________
tc-dev mailing list
tc-dev@lists.terracotta.org
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to