{"record":{"id":"7ffe01171ddd1d45","repo":"apache/incubator-seata","slug":"no-jsoncodec-provider-found-please-add-json-commo","errorCode":null,"errorMessage":"No JsonCodec provider found. Please add json-common-core to the runtime classpath.","messagePattern":"No JsonCodec provider found\\. Please add json-common-core to the runtime classpath\\.","errorType":"exception","errorClass":"JsonParseException","httpStatus":null,"severity":"critical","filePath":"common/src/main/java/org/apache/seata/common/json/JsonCodecFactory.java","lineNumber":47,"sourceCode":"\n    private JsonCodecFactory() {}\n\n    /**\n     * Get the configured JSON codec provider.\n     *\n     * @return JSON codec provider\n     */\n    public static JsonCodec getCodec() {\n        JsonCodec result = codec;\n        if (result == null) {\n            synchronized (JsonCodecFactory.class) {\n                result = codec;\n                if (result == null) {\n                    try {\n                        result = EnhancedServiceLoader.load(JsonCodec.class);\n                        codec = result;\n                    } catch (EnhancedServiceNotFoundException e) {\n                        throw new JsonParseException(\n                                \"No JsonCodec provider found. Please add json-common-core to the runtime classpath.\",\n                                e);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/json/JsonCodecFactory.java#L29-L57","documentation":"JsonCodecFactory.getCodec() lazily loads a JsonCodec implementation via the seata EnhancedServiceLoader SPI. If no provider is discoverable (EnhancedServiceNotFoundException), it throws JsonParseException telling you to add json-common-core to the runtime classpath, because the provider implementation lives in that module.","triggerScenarios":"Calling any seata API that serializes/deserializes JSON (e.g. config parsing, coordinator messages) in a deployment where the seata json-common-core jar (with its META-INF/services entry for JsonCodec) is missing, or the service file was stripped during shading.","commonSituations":"Slimming seata dependencies and dropping json-common-core; shade plugins merging/dropping META-INF/services; running only seata-common on the classpath; broken fat-jar builds.","solutions":["Add the seata json-common-core artifact (matching your seata version) to the runtime classpath.","If using maven-shade-plugin, add ServicesResourceTransformer so META-INF/services entries survive merging.","Verify with: unzip -p yourapp.jar META-INF/services/org.apache.seata.common.json.JsonCodec lists a provider class.","Ensure no dependencyMediation downgrades one json module while removing another."],"exampleFix":"<!-- before: only seata-common on classpath -->\n<dependency>\n  <groupId>org.apache.seata</groupId>\n  <artifactId>seata-common</artifactId>\n</dependency>\n\n<!-- after: add the codec provider module -->\n<dependency>\n  <groupId>org.apache.seata</groupId>\n  <artifactId>seata-common</artifactId>\n</dependency>\n<dependency>\n  <groupId>org.apache.seata</groupId>\n  <artifactId>seata-json-common-core</artifactId>\n  <version>${seata.version}</version>\n</dependency>","handlingStrategy":"validation","validationCode":"// Fail fast at boot if no JsonCodec provider is registered\nboolean codecAvailable =\n    EnhancedServiceLoader.load(JsonCodec.class) != null; // wrapped in try/catch\ntry {\n    JsonCodecFactory.getCodec();\n} catch (JsonParseException e) {\n    throw new IllegalStateException(\"seata-json-common-core missing from runtime classpath\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    JsonCodecFactory.getCodec();\n} catch (JsonParseException e) {\n    if (e.getMessage().contains(\"No JsonCodec provider\")) {\n        // add seata-json-common-core dependency and restart; not retryable within same classloader\n    }\n    throw e;\n}","preventionTips":["Pin the full seata BOM so all modules including json-common-core share one version.","After any shade/relocate build, verify META-INF/services entries survived.","Add a startup dependency check for required SPI providers."],"tags":["json","spi","classpath","dependency","seata"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}