0

I am just getting started with Kafka and encountered a bit strange behavior.

When starting the podman container of bitnami/kafka:4.0.0 image in KRaft mode, I am able to run kafka-console-consumer and kafka-console-producer from the container, but if I close the ssh session and open new one, I can not run it anymore and getting the NullPointer exception below.

If I remove old and start a new container from the new ssh session, it works again.

I tried comparing env variables across ssh sessions, they are identical. Any ideas what could I try?

podman run -d --name kafka \
  -e KAFKA_CFG_PROCESS_ROLES=broker,controller \
  -e KAFKA_CFG_NODE_ID=1 \
  -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@localhost:9093 \
  -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \
  -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092,CONTROLLER://localhost:9093 \
  -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \
  -e KAFKA_CFG_LOG_DIRS=/opt/bitnami/kafka/data \
  -p 9092:9092 \
  -p 9093:9093 \
  bitnami/kafka:4.0.0
user@host:~$ podman exec -it kafka kafka-console-producer.sh --bootstrap-server localhost:9092 --topic test-topic
java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Unknown Source)
        at java.base/sun.nio.fs.UnixFileSystem.getPath(Unknown Source)
        at java.base/java.nio.file.Path.of(Unknown Source)
        at java.base/java.nio.file.Paths.get(Unknown Source)
        at java.base/jdk.internal.platform.CgroupUtil.lambda$readStringValue$1(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at java.base/jdk.internal.platform.CgroupUtil.readStringValue(Unknown Source)
        at java.base/jdk.internal.platform.CgroupSubsystemController.getStringValue(Unknown Source)
        at java.base/jdk.internal.platform.CgroupSubsystemController.getLongValue(Unknown Source)
        at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getLongValue(Unknown Source)
        at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getHierarchical(Unknown Source)
        at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.initSubSystem(Unknown Source)
        at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getInstance(Unknown Source)
        at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(Unknown Source)
        at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(Unknown Source)
        at java.base/jdk.internal.platform.CgroupMetrics.getInstance(Unknown Source)
        at java.base/jdk.internal.platform.SystemMetrics.instance(Unknown Source)
        at java.base/jdk.internal.platform.Metrics.systemMetrics(Unknown Source)
        at java.base/jdk.internal.platform.Container.metrics(Unknown Source)
        at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(Unknown Source)
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(Unknown Source)
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(Unknown Source)
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
        at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
        at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(Unknown Source)
        at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer(Unknown Source)
        at jdk.management.agent/jdk.internal.agent.Agent.startLocalManagementAgent(Unknown Source)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Unknown Source)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Unknown Source)
Exception thrown by the agent : java.lang.NullPointerException```


0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.