Hi all. Why might I be seeing the following error?...
# troubleshooting
a
Hi all. Why might I be seeing the following error?
Copy code
2024-06-12 17:28:23,256 INFO  io.trurecognition.platform.modules.kafka.KafkaConnector      [] - Initializing KafkaConnector...
2024-06-12 17:28:23,257 INFO  io.trurecognition.platform.modules.kafka.KafkaConnector      [] - Kafka server URL: something.tec.truplatform.io:9092
2024-06-12 17:28:23,278 INFO  io.trurecognition.platform.modules.kafka.KafkaConnector      [] - Schema Registry URL: https://something.tec.truplatform.io:18085
2024-06-12 17:28:23,293 INFO  io.trurecognition.platform.modules.kafka.KafkaConnector      [] - Kafka authentication credentials are set.
2024-06-12 17:28:23,487 INFO  io.trurecognition.platform.modules.kafka.KafkaConnector      [] - KafkaConnector initialized successfully.
2024-06-12 17:28:23,489 INFO  io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Fetching schema details from: https://something.tec.truplatform.io:18085
2024-06-12 17:28:23,489 INFO  io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Fetching schema for name: json-domain-nvidia-peoplenet-people-DemographicsEvent
2024-06-12 17:28:31,514 ERROR io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Failed to retrieve schema details on attempt 1: something.tec.truplatform.io
2024-06-12 17:28:31,515 ERROR io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Unknown host: something.tec.truplatform.io
2024-06-12 17:28:33,515 INFO  io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Fetching schema details from: https://something.tec.truplatform.io:18085
2024-06-12 17:28:33,515 INFO  io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Fetching schema for name: json-domain-nvidia-peoplenet-people-DemographicsEvent
2024-06-12 17:28:33,516 ERROR io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Failed to retrieve schema details on attempt 2: something.tec.truplatform.io
2024-06-12 17:28:33,516 ERROR io.trurecognition.platform.modules.schema.SchemaRegistryManager [] - Unknown host: something.tec.truplatform.io
The schema registry is set up correctly with SSL enabled. I can use curl to register new schema, having mapped 127.0.0.1 to
something.tec.truplatform.io
in my
/etc/hosts
file. I am using the following modules:
Copy code
import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient;
import io.confluent.kafka.schemaregistry.client.SchemaRegistryClient;
import io.confluent.kafka.schemaregistry.client.rest.RestService;
import io.confluent.kafka.schemaregistry.client.rest.entities.Schema;
import io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException;
The code fails in here:
Copy code
public class SchemaRegistryManager {
  private static final Logger logger = LoggerFactory.getLogger(SchemaRegistryManager.class);
  private final SchemaRegistryClient schemaRegistryClient;
  private final RestService restService;

  // Singleton instance
  private static SchemaRegistryManager instance;

  private static final int MAX_RETRIES = 3;
  private static final long RETRY_INTERVAL_MS = 2000;

  private SchemaRegistryManager(String schemaRegistryUrl) {
    restService = new RestService(schemaRegistryUrl);
    Properties schemaRegistryProperties = new Properties();
    KafkaConnector.addSchemaRegistrySecurityProperties(schemaRegistryProperties);
    Map<String, Object> schemaRegistryPropertiesMap = new HashMap<>();
    for (String key : schemaRegistryProperties.stringPropertyNames()) {
      schemaRegistryPropertiesMap.put(key, schemaRegistryProperties.getProperty(key));
    }
    this.schemaRegistryClient =
        new CachedSchemaRegistryClient(restService, 100, schemaRegistryPropertiesMap);
  }

  /**
   * Returns the singleton instance of the SchemaRegistryManager.
   *
   * @param schemaRegistryUrl the URL of the schema registry
   * @return the singleton instance of the SchemaRegistryManager
   */
  public static synchronized SchemaRegistryManager getInstance(String schemaRegistryUrl) {
    if (instance == null) {
      instance = new SchemaRegistryManager(schemaRegistryUrl);
    }
    return instance;
  }

  /**
   * Fetches the schema details for the specified schema type and name.
   *
   * @param schemaType the type of the schema
   * @param schemaName the name of the schema
   * @return the schema details
   * @throws SchemaFetchException
   * @throws InvalidSchemaIdException
   */
  public SchemaDetails getSchemaDetails(SchemaDetails.SchemaType schemaType, String schemaName)
      throws SchemaFetchException, InvalidSchemaIdException {
    SchemaDetails schemaDetails = null;
    int attempt = 0;

    while (attempt < MAX_RETRIES) {
      try {
        logger.info("Fetching schema details from: {}", restService.getBaseUrls());
        logger.info("Fetching schema for name: {}", schemaName);

        Schema schema = restService.getLatestVersion(schemaName);
        int schemaId = schemaRegistryClient.getLatestSchemaMetadata(schemaName).getId();
        schemaDetails = new SchemaDetails(schemaType, schemaId, schema.getSchema());

        logger.info("Schema fetched with id {}:", schemaId);
        logger.info(CommonUtils.prettyPrintJson(schema.getSchema()));

        if (schemaDetails.getId() == -1) {
          throw new InvalidSchemaIdException(
              "Failed to retrieve schema ID: received -1 for schema name: " + schemaName);
        }

        logger.info("Retrieved schema ID: {}", schemaDetails.getId());
        return schemaDetails;

      } catch (IOException | RestClientException e) {
        logger.error("Failed to retrieve schema details on attempt {}: {}", attempt + 1, e.getMessage());
        if (e.getCause() instanceof java.net.ConnectException) {
          logger.error("Connection refused when connecting to schema registry at: {}", restService.getBaseUrls());
        } else if (e instanceof java.net.UnknownHostException) {
          logger.error("Unknown host: {}", e.getMessage());
        } else {
          logger.error("Error fetching schema details: {}", e.getMessage());
        }

...
With the
java.net.UnknownHostException
. My Flink jars compile as expected, but the error occurs when I attempt to upload the Flink jar to the runtime. Is there some additional config required on the runtime so the Flink jar can start?