[ https://issues.apache.org/jira/browse/UIMA-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Eckart de Castilho resolved UIMA-3692. ---------------------------------------------- Resolution: Not A Problem This issue has been supersided by UIMA-5802 in UIMAJ-Core 3.0.1 and 2.10.3 - no need anymore to track it in uimaFIT. > Classloading inconsistencies > ---------------------------- > > Key: UIMA-3692 > URL: https://issues.apache.org/jira/browse/UIMA-3692 > Project: UIMA > Issue Type: Bug > Components: uimaFIT > Affects Versions: 2.0.0uimaFIT > Reporter: Richard Eckart de Castilho > Assignee: Richard Eckart de Castilho > Priority: Minor > > The type discovery mechanism relies on Spring tech and eventually on > org.springframework.util.ClassUtils.getDefaultClassLoader() which tries the > following classloaders: > * Thread.currentThread().getContextClassLoader() > * ClassUtils.class.getClassLoader() > This allows it to override the classloader used for type scanning by setting > the thread classloader. > However, when we actually instantiate components, we rely on UIMA tech which > uses: > * getUimaContextAdmin().getResourceManager().getExtensionClassLoader() > * Class.forName(annotatorClassName) > In particular, it does not look at the thread context. > To make classloading consistent, it appears that uimaFIT should check if > there is a thread classloader and configure it as the extension classloader > for UIMA components created via uimaFIT. Because uimaFIT is using mainly > static methods, respecting the thread classloader appears to be the most > sensible thing. At least better than setting a global classloader. > To give some context: I hit this problem when running a uimaFIT pipeline from > a Jython script. The first problem was to allow uimaFIT to properly scan the > JARs in sys.path of the script context, which I did by setting the thread > classloader. After that, I tried to run a UIMA component whose class I had > defined in the script. UIMA was not able to find the class for this component: > {noformat} > Traceback (most recent call last): > File "./bad.jpy", line 39, in <module> > runPipeline( > at > org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:209) > at > org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:158) > at > org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94) > at > org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62) > at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269) > at > org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:387) > at > org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:255) > at > org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:429) > at > org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:373) > at > org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:186) > at > org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94) > at > org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62) > at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269) > at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:314) > at > org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:425) > at > org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:204) > at > org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:73) > at > org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:115) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:483) > org.apache.uima.resource.ResourceInitializationException: > org.apache.uima.resource.ResourceInitializationException: Annotator class > "org.python.proxies.__main__$Writer$1" was not found. (Descriptor: <unknown>) > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)