ksql java客户端应用程序收到来自服务器的404响应:

62lalag4  于 2021-06-04  发布在  Kafka
关注(0)|答案(0)|浏览(292)

我已经编写了ksql客户机java应用程序来从ksql表中获取主题消息的详细信息。这是从ksql表中读取主题消息的代码段。但是当我运行这个程序的时候,得到了下面的错误。请告诉我如何解决这个问题。
ksql客户端代码:

ClientOptions options = ClientOptions.create()
                   .setHost(KSQLDB_SERVER_HOST)
                   .setPort(KSQLDB_SERVER_HOST_PORT);
Client client = Client.create(options);

System.out.println("Client object value ---->"+client);
// Send requests with the client by following the other examples

String query = "SELECT * FROM TESTKSQLTBLE EMIT CHANGES;";
Map<String, Object> properties = Collections.singletonMap("auto.offset.reset", "earliest");
client.streamQuery(query, properties)
   .thenAccept(streamedQueryResult -> {
       System.out.println("Result column names: " + streamedQueryResult.columnNames());

       // RowSubscriber subscriber = new RowSubscriber();
       //streamedQueryResult.subscribe(subscriber);
   }).exceptionally(e -> {
       System.out.println("Push query request failed: " + e);
       return null;
   });

异常详细信息:

Exception in thread "main" java.util.concurrent.ExecutionException: io.confluent.ksql.api.client.exception.KsqlClientException: Received 404 response from server: HTTP 404 Not Found. Error code: 40400
        at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
        at java.util.concurrent.CompletableFuture.geta(Unknown Source)
        at my.ksqldb.app.KSQLExampleApp.main(KSQLExampleApp.java:55)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题