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

ClassLoader getResource(...) does not check WEB-INF/lib JARs #59

Open
andymc12 opened this issue Apr 30, 2019 · 0 comments
Open

ClassLoader getResource(...) does not check WEB-INF/lib JARs #59

andymc12 opened this issue Apr 30, 2019 · 0 comments

Comments

@andymc12
Copy link

Issue Overview

When my test app calls getResource("META-INF/someResource.txt") on the web app's classloader, it fails to find anything - even though the file exists in a JAR file in the WEB-INF/lib directory. When I search for the same resource using getResources, the returned set of URLs includes the URL to the resource in the WEB-INF/lib JAR file.

Expected Behaviour

The getResource method should search JAR files in the WEB-INF/lib directory after searching the WEB-INF/classes directory.

Current Behaviour

The getResource method only searches the WEB-INF/classes directory.

Steps To Reproduce
  1. Deploy a WAR file that contains a WEB-INF/lib JAR file that contains a text files called META-INF/someResource.txt.
  2. From another test case, obtain the WAR's classloader and invoke loader.getResources("META-INF/someResource.txt") - this will return an Enumeration with a URL to the resource - all good so far.
  3. From another test case, obtain the WAR's classloader and invoke loader.getResource("META-INF/someResource.txt") - this will fail.
Additional Information

I think the problem is here:

Unlike the getResources method, this method just adjusts the name for searching the WEB-INF/classes directory and then delegates to the super class. I think it should follow the same pattern as getResources and search the JAR files in the WEB-INF/lib directory.

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