You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "reckart (via GitHub)" <gi...@apache.org> on 2024/02/09 12:11:39 UTC

[I] Cannot load resource interface in OSGi context. [uima-uimaj]

reckart opened a new issue, #367:
URL: https://github.com/apache/uima-uimaj/issues/367

   **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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@uima.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org