uima-uimaj icon indicating copy to clipboard operation
uima-uimaj copied to clipboard

Cannot load resource interface in OSGi context

Open reckart opened this issue 1 year ago • 0 comments

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:

  1. Create an interface my.app.ResourceInterface
  2. Create an implementation of that interface, e.g. my.app.Resource
  3. Set up a resource manager that has a classloader that can instantiate my.app.Resource but cannot get the class for my.app.ResourceInterface
  4. Create instantiating a UIMA component that uses a my.app.Resource but via the my.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.

reckart avatar Feb 09 '24 12:02 reckart