cloudevents / cloudevents/sdk-java
An occasional problem:Unable to load implementation class JsonFormat
Nobody has claimed this yet.
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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