You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by GitBox <gi...@apache.org> on 2022/09/19 09:58:13 UTC

[GitHub] [uima-uimaj] reckart opened a new issue, #251: Resource interface class may not be found

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

   **Describe the bug**
   When running in an OSGI environment, the TCCL may have access to a component, but the component might be accessing a resource implementing an interface to which the TCCL has no access.
   
   **Expected behavior**
   If the interface class cannot be looked up through the usual path (TCCL, extension classloader), also try the classloader of the resource itself.
   
   ```
           try {
             String name = aDependencies[i].getInterfaceName();
             if (name != null && name.length() > 0) {
               Class<?> theInterface = loadUserClass(name); // <= this may only be available through the resourceClass'es classloader
   
               Class<?> resourceClass = getResourceClass(qname); // <= this may be available
               if (!theInterface.isAssignableFrom(resourceClass)) {
                 throw new ResourceInitializationException(
                         ResourceInitializationException.RESOURCE_DOES_NOT_IMPLEMENT_INTERFACE,
                         new Object[] { qname, aDependencies[i].getInterfaceName(),
                             aDependencies[i].getSourceUrlString() });
               }
             }
           } catch (ClassNotFoundException e) {
             throw new ResourceInitializationException(ResourceInitializationException.CLASS_NOT_FOUND,
                     new Object[] { aDependencies[i].getInterfaceName(),
                         aDependencies[i].getSourceUrlString() });
           }
   ```
   
   **Please complete the following information:**
    - Version: 3.2.0
   


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