uima-uimaj
uima-uimaj copied to clipboard
Cannot load resource interface in OSGi context
Describe the bug When injecting a resource into a UIMA component and the resource manager's classloader has access to the implementation class of the resources but not to the interface required by the UIMA component, then an exception is thrown. This was observed in an OSGi context.
To Reproduce Steps to reproduce the behavior:
- Create an interface
my.app.ResourceInterface - Create an implementation of that interface, e.g.
my.app.Resource - Set up a resource manager that has a classloader that can instantiate
my.app.Resourcebut cannot get the class formy.app.ResourceInterface - Create instantiating a UIMA component that uses a
my.app.Resourcebut via themy.app.ResourceInterace
Expected behavior
No exception. I guess UIMA should use the classloaded used for my.app.Resource to locate the interface or should alternatively avoid using the interface at all.
Screenshots
Caused by: org.apache.uima.resource.ResourceInitializationException: The class my.app.ResourceInterface could not be found. (Descriptor: <unknown>)
at org.apache.uima.resource.impl.ResourceManager_impl.resolveAndValidateResourceDependencies(ResourceManager_impl.java:750)
at org.apache.uima.resource.Resource_ImplBase.initialize(Resource_ImplBase.java:239)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.initialize(AnalysisEngineImplBase.java:175)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:128)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:97)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:64)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:284)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:334)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:449)
at org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:213)
at org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:289)
Please complete the following information:
- Version: 3.5.0
Additional context Add any other context about the problem here.