Also, it looks like SegmentInfos.clone() probably makes a deep clone of the SegmentInfo objects it holds, so you'd need to do that as well. I don't think you'd have any problems there calling SegmentInfo.clone().
The problem arises in this case due to a combination of the logical instrumentation of Vector and the call to native clone(), which makes instrumentation more challenging. On Oct 7, 2008, at 2:27 PM, Alex Miller wrote: > 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] >>> >>> 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