Missing UIMA type, JCas Class name: org.apache.uima.jcas.tcas.Annotation - uima

I am using uima sdk 3.3.0 and ruta-core 3.2.0.
But the builtin class org.apache.uima.jcas.tcas.Annotation is missing and not registered.
Other builtin classes are registered.

Related

UIMA Ruta version 3.1.0

I've upgraded the Uima Ruta version to 3.1.0 in Ruta Workbench.
I tried with normal Ruta project its working fine but while convert into maven project i'm getting below error.
Exception in thread "main" org.apache.uima.analysis_engine.AnalysisEngineProcessException: The JCAS cover class "org.apache.uima.ruta.type.TokenSeed_Type" could not be loaded.
at org.apache.uima.ruta.engine.RutaEngine.seedAnnotations(RutaEngine.java:947)
at org.apache.uima.ruta.engine.RutaEngine.initializeStream(RutaEngine.java:906)
at org.apache.uima.ruta.engine.RutaEngine.process(RutaEngine.java:692)
at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:401)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:318)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:269)
at org.apache.uima.ruta.ide.launching.RutaLauncher.processFile(RutaLauncher.java:242)
at org.apache.uima.ruta.ide.launching.RutaLauncher.main(RutaLauncher.java:191)
Caused by: org.apache.uima.cas.CASRuntimeException: The JCAS cover class "org.apache.uima.ruta.type.TokenSeed_Type" could not be loaded.
at org.apache.uima.jcas.impl.JCasImpl.getTypeInit(JCasImpl.java:461)
at org.apache.uima.jcas.impl.JCasImpl.getType(JCasImpl.java:425)
at org.apache.uima.jcas.impl.JCasImpl.getCasType(JCasImpl.java:478)
at org.apache.uima.jcas.impl.JCasImpl.getAnnotationIndex(JCasImpl.java:1634)
at org.apache.uima.ruta.seed.TextSeeder.seed(TextSeeder.java:43)
at org.apache.uima.ruta.engine.RutaEngine.seedAnnotations(RutaEngine.java:945)
... 8 more
**Note:**I'm using Eclipse version 2019-09 and java 1.8.
Thanks in advance
ScreenShot FYI:
I assume that there are two different versions of UIMA Ruta involved.
One version is the version of the Ruta Workbench as seen in the screenshot in the question.
When you run a Ruta script/analysis engine in maven context, then the classpath of the maven dependencies is the relevant one. This means that you are somewhat independent of the installed plugins if you develop a UIMA/Ruta based maven project.
In your case, I assume that there is an old ruta version in the maven dependencies. Or there are several and the old one wins.

UIMA Ruta, uimaFIT and DKPro: Which versions work together?

In the GSCL 2013 Ruta tutorial the versions of the components in the pom.xml are:
uimaj-core: 2.4.2
DKPro components: 1.5.0
ruta-core: 2.1.0
Now, I incremented the version numbers incrementally and found that version 1.8.0 of the DKPro components introduces the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.uima.cas.text.AnnotationIndex.withSnapshotIterators()Lorg/apache/uima/cas/FSIndex;
at org.apache.uima.fit.util.FSCollectionFactory$AnnotationIndexAdapter.iterator(FSCollectionFactory.java:821)
at de.tudarmstadt.ukp.dkpro.core.api.segmentation.SegmenterBase.process(SegmenterBase.java:145)
at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:378)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:298)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:568)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:410)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:343)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:265)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:150)
at de.tudarmstadt.ukp.tutorial.gscl2013.ruta.WhatAliceDoesExample.main(WhatAliceDoesExample.java:38)
In the last days I faced other version problems (see this question) with these components.
Can someone tell me what the most current versions of these components are that work together? Or maybe someone can give me his/her versions that he/she currently works with? I am also interested in the used eclipse version. Thank you very much. I am stuck with this issue for some time now.
Irrespective which version of DKPro Core or Ruta you use, it is a good idea to use a recent UIMA and uimaFIT version.
Note that there was an incompatible change with UIMA v3+ (uimaFIT v3+). E.g. DKPro Core 2.0.0 works with these new versions, but DKPro Core 1.x works only with UIMA v2 and uimaFIT v2. Presently (2019-10-26), there is no Ruta version compatible with UIMA v3.
Check the POM files of DKPro Core and Ruta which versions of UIMA and uimaFIT they use.
DKPro Core 2.0.0 ->
<uima.version>3.1.0</uima.version>
<uimafit.version>3.0.0</uimafit.version>
DKPro Core 1.11.0 (note change in group ID in this version) ->
<uima.version>2.10.3</uima.version>
<uimafit.version>2.4.0</uimafit.version>
DKPro Core 1.10.0 ->
<uima.version>2.10.2</uima.version>
<uimafit.version>2.4.0</uimafit.version>
DKPro Core 1.8.0 ->
<uima.version>2.8.1</uima.version>
<uimafit.version>2.2.0</uimafit.version>
Ruta 2.7.0
<uimaVersion>2.10.3</uimaVersion>
<uimafit-version>2.4.0</uimafit-version>
As for Eclipse: I'd just use the most recent version. If you experience trouble with Ruta in the latest Eclipse versions, best report it on the UIMA users' mailing list.

Unable to use Apache Commons CLI Option.builder() in Scala

In a spark shell or application (written in Scala/maven build), I am unable to use the static builder method from the Apache Commons CLI package. I have confirmed that I am including the jar in the class path and have access to the Option class along with other classes in the package like Options, DefaultParser, etc. Why can I not use this public static method in Scala?
import org.apache.commons.cli.Option
val opt = Option.builder("foo").build()
error: value builder is not a member of object org.apache.commons.cli.Option
I can however see the static fields Option.UNINITIALIZED and Option.UNLIMITED_VALUES
using commons-cli 1.3.1
Scala version: 2.11.8
Spark version: 2.2.0
command to start the shell: spark-shell --jars .m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar
Let me help you clarify your problem scenario.
You can open your .idea folder, find that it have some internal jar dependencies already, and of the list commons_cli exists, but 1.2 version.
This would lead to class collision.
The solution is straightforward, refer the doc, use the compatible constructor method.

Thrift: the import javax.annotation cannot be resolved

I use Eclipse Mars (M1) as my IDE. Today, I generated my service's Java code using Apache Thrift 0.9.2 (latest stable version) for an Android project. This version (unlke version 0.9.1) uses the "Generated" annotation from javax.annotation package, for adding some extractable documentation. It adds a line like the following line before each generated class:
#Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2014-11-30")
But surprisingly, Eclipse complains about the package javax.annotation. It throws the error "the import javax.annotation cannot be resolved". My project's Java compiler compliance level is 1.6, and its minimum Android API version is API 8 (Android 2.2). How can I fix this error?
Unfortunately most of packages under javax.* are not included in Android's JDK, therefore you need to add those that you need, manually. Here the reason for not including these packages is explained.
Unluckily, there are several versions of javax.annotation package available for download, some of which don't contain the "Generated" annotation class (javax.annotation.generated). Fortunately this jar file does include that specific annotation class. So if you don't use any build system like Gradle, Ant, or Maven, all you have to do is to include the .jar file in a directory in your project (e.g. lib/) and then add this jar library to your buildpath. If you use Ant, then follow the first link.
I had the same problem and I fixed it by adding this dependency to my build.gradle file
compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

Overload GWT Date_CustomFieldSerializer

I'm trying to overload the GWT "Date_CustomFieldSerializer" ( GWT 2.5.1 with maven2 and java1.6 ).
I've read that it is possible to overload a serializer by creating the same package structure inside your own project.
In my case I reproduce the package com.google.gwt.user.client.rpc.core.java.util to overload the class Date_CustomFieldSerializer but it does not seem to work well.
When serializing the Date, GWT Date_CustomSerializer is used but when the Date is deserialized my own "Date_CustomSerializer" is used.
If I delete the compiled Date_CustomFieldSerializer.class off gwt-user.jar and gwt-servlet.jar then my own Date_CustomFieldSerializer is always used but this is a bad solution, I am after a clean way to say to GWT that uses my own serializer always.
For delvelopment I use jetty and maven with the gwt-maven-plugin and in production mode I use weblogic.
I try to compile my own version of GWT but it fails when I try to run it, the server says:
[ERROR] Unable to initialize static dispatcher
java.lang.UnsupportedClassVersionError: com/google/gwt/core/client/JavaScriptObject$ : Unsupported major.minor version 51.0
How can I set it up to use my own serializer without GWT custom compilation?
Is your version first on the classpath?
It'a the version of Java.
You must compile the GWT Jar and your class with the same version of java.
The version 51 is the Java 7 version. (How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version)
But the GWT must be compiled with java 6.
You must set your java source to 1.6