You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "alina (JIRA)" <de...@uima.apache.org> on 2013/09/09 13:25:52 UTC
[jira] [Closed] (UIMA-3253) TypeSystemDescription throws
ClassCastException
[ https://issues.apache.org/jira/browse/UIMA-3253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
alina closed UIMA-3253.
-----------------------
Resolution: Fixed
> TypeSystemDescription throws ClassCastException
> -----------------------------------------------
>
> Key: UIMA-3253
> URL: https://issues.apache.org/jira/browse/UIMA-3253
> Project: UIMA
> Issue Type: Bug
> Components: uimaFIT
> Reporter: alina
>
> Hi all!
> We have received a strange Exception from the Type system of uimafit maybe you can help us to fix it.
> 1. First we loaded the type system from different xml-files like this:
> typeSystemDescription = TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath(
> "app/models/linguistic/descriptors/LexicalUnits.xml",
> "app/models/linguistic/descriptors/Punctuation.xml",
> "app/models/linguistic/descriptors/Word.xml",
> ...);
> 2. Then we created JCAS document
> JCas jCas = JCasFactory.createJCas(typeSystemDescription);
> 3. Then we loaded the pipeline through aggregator like this:
> AggregateBuilder builder = new AggregateBuilder();
> // create resource manager
> SimpleNamedResourceManager resourceManager = new SimpleNamedResourceManager(); resourceManager.setExtensionClassPath(Play.application().classloader(), "", true);
> // build pipeline
> builder.add(createPrimitiveDescription(LanguageAnnotator.class));
> 4. And then we wanted to iterate the annotations of the daugther type which was created in one of the annotators:
> Collection<Word> col = JCasUtil.select(jCas, Word.class);
> (*) for (Word word: col){...}
> => In this place (* ) the system threw the ClassCastException, that Annotation.class cannot be casted to Word.class.
> Inside any annotator the same lines don't throw any exception, this happens in the main program only.
> What could we do wrong?
> The problem may lay in the resource loading, since we use ResourceManager which loads the classes for the types from the PLAY (Web framework) Class loader. Maybe we have to set the ResourceManager also for JCas?
> Maybe our problem is described in chapter 5.6.7 of the UIMA Tutorial but in this case we also don't understand what to do.
> We use IntelliJ IDEA and MacOS.
> Thank you for your help.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira