uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew DeAngelis <roni...@gmail.com>
Subject Re: uimaFIT auto-detection of types
Date Fri, 11 Dec 2015 17:24:29 GMT
Thanks very much, Richard. Placing the META-INF folder in the source
directory did allow me to auto-detect within Eclipse. I have also converted
my project to Maven as per your suggestion, since I am trying to use Maven
Shade to build a jar file.

If you have some additional time, I would appreciate some assistance with
that process as well. With auto-detection and with the CollectionReader
specified, my code is now:

CollectionReaderDescription cr =
createReaderDescription(StringReader.class, StringReader.PARAM_LANGUAGE,
"en", StringReader.PARAM_DOCUMENT_ID, name,
StringReader.PARAM_DOCUMENT_TEXT, content);
AnalysisEngineDescription djread = AnalysisEngineFactory.
createEngineDescription(DJNMultiplier.class);
SimplePipeline.runPipeline(cr,djread);

Thanks to your help, this compiles and runs fine within Eclipse. With the
Maven Shade plugin installed and pointed at the above class, I can also
successfully build a jar file. However, when I run the jar file from the
command line (in Windows), I get the error
"org.apache.uima.cas.CASRuntimeException: JCas type
"de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData" used in
Java code, but was not declared in the XML type descriptor" originating in
the StringReader above. The Shade logging, however, indicates that:

[INFO] Including
de.tudarmstadt.ukp.dkpro.core:de.tudarmstadt.ukp.dkpro.core.api.metadata-asl:jar:1.7.0
in the shaded jar.

which is, I believe, where this type is stored. What else do I need to
configure to have Shade package all required descriptors?


Regards,
Matt

On Fri, Dec 11, 2015 at 5:37 AM, Richard Eckart de Castilho <rec@apache.org>
wrote:

> Hi Matt,
>
> I would recommend you set your project up as a Maven project. Eclipse
> has a great Maven support. You later mention that you want to use the
> Maven Shade plugin anyway.
>
> If you do not want to set up your project with Maven, please make sure
> that the META-INF and desc folders are contained inside a source folder.
> If you just have them in the project root, they won't end up in the
> classpath at runtime.
>
> if you do switch to Maven, make sure that "META-INF" and "desc" are
> situated
> under "src/main/resources", otherwise Maven will not put them into the JAR.
>
> That said, I'm a bit puzzled why this line would work at all:
>
> >>
> TypeSystemDescriptionFactory.createTypeSystemDescription("desc/types/DJTypes");
>
> The line above should only work if "desc/types/DJTypes.xml" can be found
> in the
> classpath.
>
> With Apache uimaFIT 2.1.0, "META-INF/org.apache.uima.fit/types.txt" is the
> right
> place to configure auto detection [1].
>
> >>> classpath*:desc/types/*.xml
>
>
> That sounds ok too. I would generally recommend to avoid wildcards here
> though.
>
> Finally, you could try increasing the log level of whatever logging
> framework you are
> using (by default that would be Java Utility Logging) to see debug output
> of the type detection.
>
> For JUL, this post [1] on StackOverflow might help (mind for JUL you need
> to set the
> level to FINEST). I use log4j most of the time and there is a post here
> [2] indicating
> how to set the log level.
>
> Cheers,
>
> -- Richard
>
> [1] http://stackoverflow.com/a/25677104/2511197
> [2]
> https://groups.google.com/d/msg/dkpro-core-user/YKQnvNJHaLk/e0EZRm7COmIJ
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message