Skip to content

Not Finding Classpath Elements on Java 11  #382

@jamesward

Description

@jamesward

I'm using ClassGraph 4.8.53 and having a problem with Java 11 not finding classpath elements but it's working on Java 8.

Here is what I'm seeing on Java 11:

2019-11-17T08:01:56.968-0700	ClassGraph	Finding classpath
2019-11-17T08:01:56.968-0700	ClassGraph	-- Finding classpath and modules
2019-11-17T08:01:56.969-0700	ClassGraph	---- Found ClassLoaders:
2019-11-17T08:01:56.969-0700	ClassGraph	------ jdk.internal.loader.ClassLoaders$AppClassLoader
2019-11-17T08:01:56.969-0700	ClassGraph	---- Overriding classpath with: jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
2019-11-17T08:01:56.969-0700	ClassGraph	------ Found classpath element: jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd -> /home/jw/projects/webjars/webjars-play/jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd
2019-11-17T08:01:56.969-0700	ClassGraph	------ WARNING: when the classpath is overridden, there is no guarantee that the classes found by classpath scanning will be the same as the classes loaded by the context classloader
2019-11-17T08:01:56.969-0700	ClassGraph	-- Module scanning is disabled, because classloaders or classpath was overridden
2019-11-17T08:01:56.970-0700	ClassGraph	Opening classpath elements (took 0.026549 sec)
2019-11-17T08:01:56.970-0700	ClassGraph	-- Skipping invalid classpath element /home/jw/projects/webjars/webjars-play/jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd : java.io.FileNotFoundException
2019-11-17T08:01:56.996-0700	ClassGraph	Finding nested classpath elements
2019-11-17T08:01:56.996-0700	ClassGraph	Final classpath element order:
2019-11-17T08:01:56.997-0700	ClassGraph	Scanning classpath elements (took 0.000006 sec)
2019-11-17T08:01:56.997-0700	ClassGraph	Classfile scanning is disabled

This seems to only be a problem when I call overrideClassLoaders(classLoader). If I call getResources on the classloader I can see everything I'm looking for.

Sorry I don't understand much about how the classpath stuff might have changed in Java 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions