You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Georg Bonczek <ge...@tum.de> on 2017/09/21 14:30:45 UTC
UIMA Ruta classloader issues
Hi,
I'm having difficulties setting up an AnalysisEngine containing JCas
Annotators and a Ruta script that calls extension functions using the
Play framework. Since the Play framework uses its own hierarchy of
classloaders, the system classloader somehow does not find the extension
classes.
When creating the type system and descriptors for the Ruta script, I can
pass the classloader used by the framework through the RutaBuildOptions.
But when creating an AnalysisEngine, the
initializeExtensionWithClassPath() method in the RutaEngine class does
only use Class.forName(each) to instanciate the extensions. When
replacing this call with
this.resourceManager.getExtensionClassLoader().loadClass(each);
and setting the manager's classloader to the one used by the framework,
the extensions get instanciated and the execution of the rule succeedes.
Is this behaviour expected and is there a way around this without having
to change the RutaEngine class? Please find the relevant parts of my
source code here:
https://gist.github.com/zekrg/42d0bea5a2c9c561d152a6df268318d5.
Thanks for your help.
Re: UIMA Ruta classloader issues
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
short answer: this should be fixed in RutaEngine
Ruta did not support special classloader in previous version (like
PEARs), but obviously not all functionality has been fixed.
The classloader in RutaBuildOptions in used only for building the
descriptors, like finding imports by name when creating the type system
descriptor, in special environments like in a maven build process or
within a eclipse plugin.
Thanks for reporting this. I'll open a Jira issue for it and fix it ASAP.
Best,
Peter
Am 21.09.2017 um 16:30 schrieb Georg Bonczek:
> Hi,
>
> I'm having difficulties setting up an AnalysisEngine containing JCas
> Annotators and a Ruta script that calls extension functions using the
> Play framework. Since the Play framework uses its own hierarchy of
> classloaders, the system classloader somehow does not find the
> extension classes.
>
> When creating the type system and descriptors for the Ruta script, I
> can pass the classloader used by the framework through the
> RutaBuildOptions. But when creating an AnalysisEngine, the
> initializeExtensionWithClassPath() method in the RutaEngine class does
> only use Class.forName(each) to instanciate the extensions. When
> replacing this call with
>
> this.resourceManager.getExtensionClassLoader().loadClass(each);
>
> and setting the manager's classloader to the one used by the
> framework, the extensions get instanciated and the execution of the
> rule succeedes. Is this behaviour expected and is there a way around
> this without having to change the RutaEngine class? Please find the
> relevant parts of my source code here:
> https://gist.github.com/zekrg/42d0bea5a2c9c561d152a6df268318d5.
>
> Thanks for your help.
>
>