Skip to content

Cannot invoke "java.lang.ClassLoader.getParent()" because "this.currentLoader" is null #643

@flebastard

Description

@flebastard

Hi,
Since cloudevents-core:3.0.0, we are experiencing this error

java.lang.NullPointerException: Cannot invoke "java.lang.ClassLoader.getParent()" because "this.currentLoader" is null
	at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1075)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at io.cloudevents.core.provider.CloudEventValidatorProvider.validate(CloudEventValidatorProvider.java:48)
	at io.cloudevents.core.v1.CloudEventBuilder.build(CloudEventBuilder.java:127)

This does not happen every time we use the builder. I suspect a race condition as CloudEventValidatorProvider is a Singleton that relies on the ServiceLoader class which is not thread safe according to its documentation.

Instances of this class are not safe for use by multiple concurrent threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions