Should ClassLoader::getResouces return the same resource twice?

Alan Bateman Alan.Bateman at oracle.com
Sat Jan 2 17:49:21 UTC 2021


On 02/01/2021 12:59, Thiago Henrique Hupner wrote:
> I guess a little context can make more things clear:
> The servlet spec requires that all jars from WEB-INF/lib
> be available to the same classloader.
> The resource, in particular, is "META-INF/web-fragment.xml"
> Each jar can contain its own. So, using getResources make sense
> in order of parsing each. However, what is happening is if I have two JARs
> each with its own META-INF/web-fragment.xml, using the ModuleReader
> it is returning four resources, so it parses more than it should and 
> it fails
> to parse the same resource twice.
>
Which parent class loader are you specifying to 
defineModulesWithOneLoader? It it possible that it locates the resource 
in the two JAR files?

-Alan


More information about the jigsaw-dev mailing list