apache/druid · error · ParseException

Thrift class [ ] not found

Error message

Thrift class [%s] not found

What it means

toFlattenedMap() resolves the Thrift class via getThriftClass() and instantiates it inside the try block; this branch converts ClassNotFoundException (and related linkage errors from instantiation) into a ParseException. It fires when the configured Thrift class name cannot be found on the Druid process classpath, i.e. a configuration/deployment problem rather than bad input data.

Solutions

  1. Add the JAR containing the generated Thrift classes to the classpath or load it as a Druid extension
  2. Correct the thriftClass name in the reader configuration (package and class must match exactly)
  3. Restart affected Druid processes so they pick up the newly deployed extension jars
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at extensions-contrib/thrift-extensions/src/main/java/org/apache/druid/data/input/thrift/ThriftReader.java:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/f20fb0ca15711f26. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/thrift-extensions/src/main/java/org/apache/druid/data/input/thrift/ThriftReader.java:123

  private Map<String, Object> toFlattenedMap(byte[] bytes) throws ParseException
  {
    try {
      final Class<TBase> clazz = getThriftClass();
      final TBase tbase = clazz.newInstance();
      ThriftDeserialization.detectAndDeserialize(bytes, tbase);
      final String json = ThriftDeserialization.SERIALIZER_SIMPLE_JSON.get().toString(tbase);
      final JsonNode node = OBJECT_MAPPER.readTree(json);
      return recordFlattener.flatten(node);
    }
    catch (TException | IOException e) {
      throw new ParseException(null, e, "Failed to deserialize Thrift data");
    }
    catch (InstantiationException | IllegalAccessException e) {
      throw new ParseException(null, e, "Failed to instantiate Thrift class [%s]", thriftClassName);
    }
    catch (ClassNotFoundException e) {
      throw new ParseException(null, e, "Thrift class [%s] not found", thriftClassName);
    }
  }

  @SuppressWarnings({"unchecked", "ReturnValueIgnored"})
  private Class<TBase> getThriftClass() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
  {
    if (thriftClass == null) {
      final Class<TBase> clazz;
      if (jarPath != null) {
        File jar = new File(jarPath);
        URLClassLoader child = new URLClassLoader(
            new URL[]{jar.toURI().toURL()},
            this.getClass().getClassLoader()
        );
        clazz = (Class<TBase>) Class.forName(thriftClassName, true, child);
      } else {
        clazz = (Class<TBase>) Class.forName(thriftClassName);
      }

View on GitHub (pinned to 9b90983fd2)