cloudevents/sdk-java

An occasional problem:Unable to load implementation class JsonFormat

epiao55 opened this issue · 1 comments

I have a cluster that deploys the same image, with a total of six nodes. Occasionally, some nodes do not load the JsonFormat class,
The relevant codes are as follows

EventFormat eventFormat = EventFormatProvider.getInstance()
                    .resolveFormat(JsonFormat.CONTENT_TYPE);
            if (eventFormat == null) {
                logger.info("resolveFormat failed,force retry..");
                eventFormat = new JsonFormat().withForceNonJsonDataToString();
                if (eventFormat != null) {
                    logger.info("resolveFormat failed,retry success..");
                }
                EventFormatProvider.getInstance().registerFormat(eventFormat);
                return eventFormat;

i observed that the SPI mechanism did not take effect on the problem node and manually instantiated the successful log of the JsonFormat class.
I can't understand why this situation occurs. It occurs relatively infrequently, but it does exist. The current solution is not elegant enough, and I hope to receive help.

this is my version
image

It seems a problem on how you're packaging your application to me, can you share a minimal reproducer?