cloudevents / cloudevents/sdk-java

An occasional problem:Unable to load implementation class JsonFormat

Open
#570 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-user-input
Dominant language
Java
Stars
446
Forks
172
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE), the JsonFormat implementation, and the SPI registration path. Compare behavior on affected and healthy nodes using the reported deployment and version. Done means the intermittent loading failure is reproduced or explained and a concrete corrective change is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.