Search code examples
apache-kafkahortonworks-data-platformapache-kafka-connect

How to hide stack trace of Kafka connect api unhandled exception


As part of registering connectors in distributed mode, when some invalid json payload is passed in API request , I am getting error in response with full stack trace, which is not desirable in my case.

Response example:

HTTP/1.1 500 Internal Server Error Connection: close Date: Fri, 26 Jul 2019 08:27:17 GMT Content-Type: application/json Content-Length: 443 Server: Jetty(9.4.11.v20180605)
{"error_code":500,"message":"Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('')\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor $UnCloseableInputStream); line: 2, column: 46] (through reference chain: org.apache.k afka.connect.runtime.rest.entities.CreateConnectorRequest[\"config\"])"}

Is there any way to hide or shorten the full stack trace.

Note: I am using Hortonworks Kafka package.


Solution

  • The REST API returns what the REST API returns :)

    So you could either (a) stop sending invalid JSON ;) (b) compile your own version of Kafka and disable the bits of output you don't want returned.