{"record":{"id":"6b76eb1d6f479832","repo":"eclipse-vertx/vert.x","slug":"mapping-tovaluetype-getname-is-not-available","errorCode":null,"errorMessage":"Mapping ${toValueType.getName()}  is not available without Jackson Databind on the classpath","messagePattern":"Mapping (.+?)  is not available without Jackson Databind on the classpath","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/json/jackson/JacksonCodec.java","lineNumber":147,"sourceCode":"  @Override\n  public <T> T fromBuffer(Buffer json, Class<T> clazz) throws DecodeException {\n    return fromParser(createParser(json), clazz);\n  }\n\n  @Override\n  public <T> T fromStream(InputStream in, Class<T> clazz) throws DecodeException {\n    try {\n      JsonParser parser = factory.createParser(in);\n      parser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);\n      return fromParser(parser, clazz);\n    } catch (IOException e) {\n      throw new DecodeException(\"Failed to decode:\" + e.getMessage(), e);\n    }\n  }\n\n  @Override\n  public <T> T fromValue(Object json, Class<T> toValueType) {\n    throw new DecodeException(\"Mapping \" + toValueType.getName() + \"  is not available without Jackson Databind on the classpath\");\n  }\n\n  @Override\n  public String toString(Object object, boolean pretty) throws EncodeException {\n    BufferRecycler br = factory._getBufferRecycler();\n    try (SegmentedStringWriter sw = new SegmentedStringWriter(br)) {\n      JsonGenerator generator = createGenerator(sw, pretty);\n      encodeJson(object, generator);\n      generator.close();\n      return sw.getAndClear();\n    } catch (IOException e) {\n      throw new EncodeException(e.getMessage(), e);\n    } finally {\n      br.releaseToPool();\n    }\n  }\n\n  @Override","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/json/jackson/JacksonCodec.java#L129-L165","documentation":"JacksonCodec's non-Databind variant cannot map JSON values onto arbitrary Java classes; it only produces basic JSON types (Map, List, String, Number, Boolean, null). Mapping to a user class requires Jackson Databind on the classpath, so calling fromValue(Object, Class) without it always throws this DecodeException.","triggerScenarios":"Calling JacksonCodec.fromValue(json, SomeClass.class) (or Json.decodeValue targeting a POJO) while jackson-databind is absent from the classpath.","commonSituations":"Using vertx-core without the jackson-databind dependency and trying to decode JSON into a POJO; a build change (shade/exclude) dropped databind; using the wrong codec class in a custom SPI after removing Databind.","solutions":["Add io.vertx:vertx-codec-jackson (or jackson-databind) to the classpath","Use fromValue(json, Map.class) or parse to Map/List instead of a POJO","Manually map the resulting Map<String,Object> onto your class","Verify no dependency exclusion/shading removed jackson-databind"],"exampleFix":"// before\nMyConfig cfg = JacksonCodec.fromValue(json, MyConfig.class); // no databind\n// after\nMap<String, Object> map = JacksonCodec.fromValue(json, Map.class);\n// or add dependency: io.vertx:vertx-codec-jackson with jackson-databind","handlingStrategy":"fallback","validationCode":"// Java\nstatic boolean databindAvailable() {\n  try {\n    Class.forName(\"com.fasterxml.jackson.databind.ObjectMapper\");\n    return true;\n  } catch (ClassNotFoundException e) { return false;\n  }\n}","typeGuard":"static boolean canMapPojo(Class<?> target) {\n  return databindAvailable() && !Map.class.isAssignableFrom(target) && !List.class.isAssignableFrom(target);\n}","tryCatchPattern":"try {\n  return JacksonCodec.fromValue(json, MyConfig.class);\n} catch (DecodeException e) {\n  if (e.getMessage().contains(\"not available without Jackson Databind\")) {\n    return manualMap(JacksonCodec.fromValue(json, Map.class)); // fallback\n  }\n  throw e;\n}","preventionTips":["Add jackson-databind (or vertx-codec-jackson) when POJO mapping is needed","Add a classpath smoke test at startup for ObjectMapper","Avoid shade/exclude rules that silently drop jackson-databind","Fall back to Map/List decoding in environments without databind"],"tags":["json","decoding","missing-dependency","jackson-databind"],"backgroundTag":"missing-optional-dependency","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}