Markus Weimer wrote:
Hi,
I am building an application that requires to use AnalysisEngines
without a CPE surrounding it. However, using a reader that imports a
type system by name instead of by value raises the following
Exception:
CASRuntimeException: JCas type TYPE used in Java code, but was not
declared in the XML type descriptor.
Is there any special magic involved in making import by name working
inside an Application?
Thanks in advance,
Markus
What this exception means is that somewhere in your code, you use a Java
class named "TYPE"
which was generated from a CAS Type system description. Each use of a
JCas type is done with
reference to a particular CAS instance. Each CAS instance, in turn,
contains a type system. But the
type system in the CAS instance being used does not include the type "TYPE".
Your application creates the CAS and initializes it with a type system,
either directly or indirectly (by
instantiating an Analysis Engine). For details on this, please see the
chapter Application Developer's
Guide in the UIMA Tutorials and Developers' Guide.
To debug this further, please try the following:
1) inspect the CAS at the time of the error and confirm that its type
system is missing the type "TYPE".
2) look through your code and see where you set up the CAS type system.
You probably read a UIMA
XML descriptor to set this up. Check that that UIMA XML descriptor
defines the type TYPE.
-Marshall