Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Criar Topic localmente

Quando eu dou o comando:

bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic LOJA_NOVO_PEDIDO

o Console me retorna o seguinte erro:

log4j:ERROR Could not read configuration file from URL [file:/c/apps/kafka_2.13-2.6.0/bin/../config/tools-log4j.properties].
java.io.FileNotFoundException: \c\apps\kafka_2.13-2.6.0\bin\..\config\tools-log4j.properties (O sistema não pode encontrar o caminho especificado)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.slf4j.impl.Log4jLoggerFactory.<init>(Log4jLoggerFactory.java:66)
        at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
        at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
        at com.typesafe.scalalogging.Logger$.apply(Logger.scala:48)
        at kafka.utils.Log4jControllerRegistration$.<clinit>(Logging.scala:25)
        at kafka.admin.TopicCommand$.<clinit>(TopicCommand.scala:47)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)
log4j:ERROR Ignoring configuration file [file:/c/apps/kafka_2.13-2.6.0/bin/../config/tools-log4j.properties].
log4j:WARN No appenders could be found for logger (kafka.utils.Log4jControllerRegistration$).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic LOJA_NOVO_PEDIDO.

Como pode vê o tópico foi realmente criado, porém está dando erro ao localizar o caminho tools-log4j.properties. Teria algum jeito executar sem ficar dando esse erro?Estou usando o Kafka 2.13-2.6.0

1 resposta
solução!

Consegui resolver o problema era no arquivo:

bin / kafka-run-class.sh

Você abre esse arquivo e procurar por:

KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}"

E substituir pelo código:

KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$(cygpath -wp $base_dir/config/tools-log4j.properties)"

Com isso não dará mais erro ao criar falando que não achou a caminho dos logs.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software