Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.util.ServiceLoader does not work with JarFileClassLoader #214

Open
slawomirkisiel opened this issue Jul 31, 2020 · 0 comments
Open

Comments

@slawomirkisiel
Copy link
Contributor

Description:
When you want to use ServiceLoader with JarFileClassLoader it fails not founding any implementation of selected service class.

Current flow looks like this:

  1. ServiceLoader class invokes getResources on base ClassLoader class.
  2. This method invokes {@link org.apache.axis2.classloader.MultiParentClassLoader#findResources(String)} method.
  3. Subsequently super.findResources(String) method is executed which is {@link java.net.URLClassLoader#findResources(String)}.

Method
{@link org.apache.axis2.classloader.JarFileClassLoader#internalfindResources} is never executed and this is the place where {@link org.apache.axis2.classloader.UrlResourceFinder} resourceFinder object is used to fetch resources. On the contrary {@link org.apache.axis2.classloader.JarFileClassLoader#getResource(String)} method is used directly when try to fetch single resource object. This gives inconsistency by returning valid object with getResource(String) method but empty Enumeration by getResources(String) method.
Suggested Labels:
JarFileClassLoader, ServiceLoader, findResources, internalfindResources

Suggested Assignees:

Affected Product Version:
master branch

OS, DB, other environment details and versions:
does not matter

Steps to reproduce:
Use java.util.ClassLoader in combination with JarFileClassLoader.

Related Issues:

Suggested solution
Implement findResources method instead of internalfindResources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant