• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

카프카 커넥트 서버 기동시 발생하는 오류

21.04.22 23:41 작성 조회수 3.4k

4

안녕하세요 선생님, 좋은 강의 잘 듣고 있습니다.

오늘은 카프카 커넥션 서버 기동시 발생하는 오류가 있어 질문드립니다.

우선, 발생하는 오류에 대한 로그 정보는 아래와 같습니다.

  log4j:ERROR Could not read configuration file from URL [file:C:/kafka_demo/confluent-6.1.0/config/tools-log4j.properties].
java.io.FileNotFoundException: C:\kafka_demo\confluent-6.1.0\config\tools-log4j.properties (지정된 경로를 찾을 수 없습니다)
  at java.base/java.io.FileInputStream.open0(Native Method)
  at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
  at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
  at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
  at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
  at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
  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 org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
  at org.apache.kafka.connect.cli.ConnectDistributed.<clinit>(ConnectDistributed.java:57)
  log4j:ERROR Ignoring configuration file [file:C:/kafka_demo/confluent-6.1.0/config/tools-log4j.properties].
  log4j:WARN No appenders could be found for logger (org.apache.kafka.connect.runtime.WorkerInfo).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  4월 22, 2021 10:13:57 오후 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.LoggingResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.LoggingResource will be ignored.
  4월 22, 2021 10:13:57 오후 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource will be ignored.
  4월 22, 2021 10:13:57 오후 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource will be ignored.
  4월 22, 2021 10:13:57 오후 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.RootResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.RootResource will be ignored.
  4월 22, 2021 10:13:58 오후 org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: The (sub)resource method listLoggers in org.apache.kafka.connect.runtime.rest.resources.LoggingResource contains empty path annotation.
WARNING: The (sub)resource method createConnector in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotation.

WARNING: The (sub)resource method listConnectors in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotation. WARNING: The (sub)resource method listConnectorPlugins in org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource contains empty path annotation.
WARNING: The (sub)resource method serverInfo in org.apache.kafka.connect.runtime.rest.resources.RootResource contains empty path annotation.

위 로그를 보고 confluent-6.1.0 폴더에 config\tools-log4j.properties 라는 파일이 없어 이 문제가 발생한다고 생각 했습니다. 그래서 카프카 서버를 설치한 곳에 있는 \config\tools-log4j.properties 파일을 복사해 생성해주었지만 또 다른 오류가 발생하고 해결이 되지 않았습니다.

하지만, 동작은 선생님께서 하신 실습처럼 정상적으로 동작합니다. 다만 로그가 발생하지 않고 있습니다.

검색을 해봤지만 해결하지 못해 도움 부탁드립니다.

답변 5

·

답변을 작성해보세요.

5

cnw529님의 프로필

cnw529

2021.08.02

저도 같은 문제가 발생했습니다만 해결되어 글을 남깁니다.

Kafka Connect에서 설정 관련 디렉토리는 config가 아닌 etc 입니다.

하지만 connect-distributed.bat에서는 log4j의 경로를 존재하지 않는 %BASE_DIR%/config/connect-log4j.properties으로 잡고 있습니다.

따라서 connect-distributed.bat의 log4j 경로를 %BASE_DIR%/config/connect-log4j.properties에서 %BASE_DIR%/etc/kafka/connect-log4j.properties로 바꾸어주면 해결 가능합니다.

Truestar님의 프로필

Truestar

2021.08.02

성공하신 서버 초기 로그 캡쳐 부탁드려도 될까요?

애러 없는 로그화면을 본적이없어서 비교를 해봐야 제 서버 이상여부를 확인할수 있을것 같습니다

cnw529님의 프로필

cnw529

2021.08.03

서버 초기 로그는 다음과 같습니다.

Truestar님의 프로필

Truestar

2021.08.03

그렇다면 이건 Confluent 서버 제작자의 bat 스크립트 작성 실수라고 봐야 겠군요..
`서버 제작사 측에서 실수 할 리 없다` 라고 믿어버린게 잘못이네요ㅎㅎ
배포된 스크립트를 수정하는게 영 껄끄러워서 시도는 했으나, 원본을 그냥 써야겠다 했다가
이런 사태가 났지요..

공유 감사드립니다!

cnw529님의 프로필

cnw529

2021.08.03

kafka connect connect-distributed의 쉘과 배치 파일의 초기 코드 상태입니다.

해당 파일은 confluent-6.1.0 기준이며 최신 버전인  confluent-6.2.0에서도 동일합니다.

우선 쉘 파일에서는 log4j에 대해서 etc 하위 경로를 기본적으로 잡아주고 있으나, 배치 파일에서는 그렇지 않음을 확인할 수 있습니다.

이를 참고하여 log4j 관련 에러가 발생하시는 분들의 문제 해결에 도움이 될 수 있기를 바랍니다 :)

  • connect-distributed.sh
  • connect-distributed.bat
우창혁님의 프로필

우창혁

2022.01.05

킹갓 cnw....

hungryo님의 프로필

hungryo

2022.03.18

cnw529님 감사합니다. 킹왕짱!

wnehdtk3님의 프로필

wnehdtk3

2022.11.09

감사합니닷~

2

안녕하세요, 이도원입니다. 

위의 로그에서 보이는 것 처럼, C:\kafka_demo\confluent-6.1.0\config\tools-log4j.properties 파일이 존재하면 해당 경로 메시지는 표시 되지 않을 겁니다. 위 로그 메시지는 로그에 관련된 설정 파일이 없다는 에러이면, 존재하지 않는다 하더라도 카프카 실행에는 영향을 미치지 않을 겁니다. 만약 다른 오류가 발생하셨다면, 해당 오류를 공유해 주시면 원인을 찾아보도록 하겠습니다. 

참고로, 간혼 카프카 실행에 있어서, 토픽에 문제가 생겨 정상적으로 실행할 수 없는 경우가 있습니다. C:\tmp 폴더의 zookeeper, kafka 관련 폴더를 삭제하신 다음에 Zookeeper 다시 실행해 보시면, 초기화 된 상태에서 시작하실 수 있습니다.

감사합니다. 

0

안녕하세요, 이도원입니다. 

보내주신 내용으로 정확한 내용을 확인 하기가 조금 어렵네요. 도움을 드리지 못해 죄송합니다. 

혹시, 아래 링크에 있는 파일로 한번 테스트해 보실 수 있을까요? 제가 MacOS, WindowsOS에서 테스트한 Kafka Connect 파일입니다. 

https://drive.google.com/file/d/1DoRSdkbB5GZyUzhqRGtaFmoJp2WSzKN1/view?usp=sharing

감사합니다. 

Truestar님의 프로필

Truestar

2021.07.07

응답 감사합니다.
보내주신 파일과, gzip 원본 을 분석하는 도중 단순한 차이점을 발견했습니다. 

좌측이 강사님 properties 이고, 우측이 gzip 원본에 포함된(애러나는) properties 입니다.
정리해보면, 

  1. 초기 애러가(log4j 설정파일이 없는문제) confluent-community-6.1.0.tar.gz  배포파일 내부에
    /config/tools-log4j.properties 가 없어서 나는 애러였고,

  2. log4j 경로 해결을 위해 배포판 /etc/tools-log4j.properties 를 참조시키니까
    log4j 설정문제로 추가 애러가 발생한 것이라고 판단됩니다.

아래는 properties 추가 후, confluent 서버 부트 Log 입니다

log4j:WARN No appenders could be found for logger (org.apache.kafka.connect.runtime.WorkerInfo).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
7월 07, 2021 10:12:01 오전 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.RootResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.RootResource will be ignored.
7월 07, 2021 10:12:01 오전 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource will be ignored.
7월 07, 2021 10:12:01 오전 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.LoggingResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.LoggingResource will be ignored.
7월 07, 2021 10:12:01 오전 org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource will be ignored.
7월 07, 2021 10:12:01 오전 org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: The (sub)resource method listLoggers in org.apache.kafka.connect.runtime.rest.resources.LoggingResource contains empty path annotation.
WARNING: The (sub)resource method createConnector in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotation.
WARNING: The (sub)resource method listConnectors in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotation.
WARNING: The (sub)resource method listConnectorPlugins in org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource contains empty path annotation.
WARNING: The (sub)resource method serverInfo in org.apache.kafka.connect.runtime.rest.resources.RootResource contains empty path annotation.

단순히 `내용없는 설정파일`을 `/config/` 폴더에 넣어주는것으로 해결점을 찾은것 같습니다.

이렇게 로그가 찍히는게 잘 실행 된건가요??

0

고동동님의 프로필

고동동

2021.07.02

저도 같은 문제가 발생중입니다. ㅠㅠ

0

Truestar님의 프로필

Truestar

2021.06.10

질문을 따로 남기려다, 중복인듯 하여 여기다 남깁니다^
참고로, 저는 윈도우 `bat` 파일 실행 환경 입니다

  • log4j 설정파일 예외 처리는 아래와 같이 해결이 가능합니다.
  • 다만 이것이 해결되고 난 후, 다른 애러를 보게됩니다

카프카 커넥트 Root:
\bin\windows\kafka-run-class.bat

파일의 Log4j 설정에
IF, ELSE 문 사이에 `ELSE IF` 문을 추가하였습니다

rem Log4j settings
IF ["%KAFKA_LOG4J_OPTS%"EQU [""] (
    if exist %~dp0../../etc/kafka/tools-log4j.properties (
        set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../etc/kafka/tools-log4j.properties
   ) else (
        set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%BASE_DIR%/config/tools-log4j.properties
    )
ELSE IF exist %~dp0../../etc/kafka/tools-log4j.properties (
    set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../etc/kafka/tools-log4j.properties
) ELSE (
  rem create logs directory
  IF not exist "%LOG_DIR%" (
      mkdir "%LOG_DIR%"
 )
)

이것으로, Log4j 설정문제는 해결이 되는데,
해결하자마자 질분자 분꼐서 발견하신듯한 오류를 발견했습니다. 내용은 다음과 같습니다

[2021-06-10 09:22:59,357] WARN could not get type for name org.osgi.framework.BundleActivator from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name org.osgi.framework.BundleActivator
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,360] WARN could not get type for name org.antlr.v4.runtime.BaseErrorListener from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name org.antlr.v4.runtime.BaseErrorListener
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,361] WARN could not get type for name org.antlr.v4.runtime.Lexer from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name org.antlr.v4.runtime.Lexer
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,366] WARN could not get type for name com.microsoft.azure.keyvault.authentication.KeyVaultCredentials from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name com.microsoft.azure.keyvault.authentication.KeyVaultCredentials
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,368] WARN could not get type for name org.osgi.service.jdbc.DataSourceFactory from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name org.osgi.service.jdbc.DataSourceFactory
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,518] WARN could not get type for name javax.resource.spi.ManagedConnectionMetaData from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name javax.resource.spi.ManagedConnectionMetaData
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...

[2021-06-10 09:22:59,521] WARN could not get type for name javax.resource.spi.ConnectionRequestInfo from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name javax.resource.spi.ConnectionRequestInfo
        at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:312)
        ...
        ...
        ...


강사님 이것과 관련된 해결방법이 있을까요?