Hi Veena,

Sorry you're having some troubles...

These problems are usually due to classpath issues.

When you do the JCasGen, it will have put the generated jcas classes somewhere.

These newly generated classes have to be in the classpath instead of the
previously generated JCas classes.

Additionally, UIMA Version 3 doesn't use the classes named xxx_Type (e.g.
EntityAnnotation_Type).
Please make sure these (and of course, the version 2 of the JCas gen'd classes)
are not in the class path.

-Marshall

On 5/28/2020 4:47 PM, Veena Reddy wrote:
> Trying to update uima from 2.x to 3.1. 
>
> As detailed in the upgrade notes ran the JCasGen to generate new Annotation 
> classes. The Annotator class extends the JCasAnnotator_ImplBase and 
> implements the process(Jcas) method. 
>
> During execution a ClassCastException is being thrown in the process(Jcas) 
> method of the Annotator class when creating an annotation using the 
> constructor Annotation (JCas jcas, int begin, int end) . 
>
>  com.tas.EntityAnnotation cannot be cast to org.apache.uima.jcas.impl.JCasImpl
>         at org.apache.uima.jcas.cas.TOP.<init>(TOP.java:87)
>         at 
> org.apache.uima.jcas.cas.AnnotationBase.<init>(AnnotationBase.java:92)
>         at org.apache.uima.jcas.tcas.Annotation.<init>(Annotation.java:83)
>
> org.apache.uima.jcas.cas.TOP constructor implementation changed between both 
> 2.x and 3.x versions and the ClassCastException is being thrown in the 
> TOP.java JCas constructor. 
>
>   public TOP(JCas jcas) {
>           super((JCasImpl) jcas);
>   }
>
>  Any help will be greatly appreciated. 
>
> Best Regards,
> VR
>       

Reply via email to