Skip to content

json validation: FileNotFoundException: classpath:spdx.schema.json #849

@raboof

Description

@raboof

json validation may throw a FileNotFoundException: classpath:spdx.schema.json.

This is because the SchemaRegistry that's created in CycloneDxSchema#getJsonSchema resolves the classpath resource with SchemaLoader.CLASSPATH_RESOURCE_LOADER, which uses whatever classpath is in Thread.currentThread().getContextClassLoader() when com.networknt.schema.resource.SchemaLoader is initialized. This may or may not be a classloader that can load spdx.schema.json.

I'm not sure if this should be a bug in cyclonedx-core-java or an upstream bug in json-schema-validator, but I'm encountering it through cyclonedx-core-java, so I'm starting by registering it here :)

(FWIW this started failing for us between 11.0.1 and 12.2.0, haven't looked into why it worked on 11.0.1)

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