Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

Solved Go to solution

Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

New Contributor

I have HDP 2.3.2 Sandbox. Currently I am learning Kafka and following the Hortonwok Kafka tutorial, Real time Data transportation and Ingestion. If I run the tutorial from my windows box, which is outside of Sandbox, (see [1]), I got the SocketTimeoutException (see [2]). I can see the socket connection is established from my windows box to HDP Sandbox and I can access Ambari and Hue from my windows box. I have verified that SELinux on HDP Sandbox has been disabled.

However if I copy the jar from my windows box to HDP Sandbox and run it inside HDP Sandbox, everything is fine as I can see the messages have been successfully published.

Could you please anyone give me a clue how to solve this issue? Many thanks in advance.

[1] command to run Hortonwork Kafka Tutorial

java -cp target/Tutorial-1.0-SNAPSHOT.jar com.hortonworks.tutorials.tutorial1.TruckEventsProducer sandbox.hortonworks.com:6667 sandbox.hortonworks.com:2181

[2] SocketTimeException

16/02/09 09:41:50 WARN client.ClientUtils$: Fetching topic metadata with correlation id 0 for topics [Set(truckevent)] from broker [BrokerEndPoint(0,sandbox.hortonworks.com,6667)] failed java.net.SocketTimeoutException at sun.nio.ch.SocketAdaptor$SocketInputStream.read(Unknown Source) at sun.nio.ch.ChannelInputStream.read(Unknown Source) at java.nio.channels.Channels$ReadableByteChannelImpl.read(Unknown Source) at kafka.utils.CoreUtils$.read(CoreUtils.scala:192) at kafka.network.BoundedByteBufferReceive.readFrom(BoundedByteBufferReceive.scala:54) at kafka.network.Receive$class.readCompletely(Transmission.scala:56) at kafka.network.BoundedByteBufferReceive.readCompletely(BoundedByteBufferReceive.scala:29) at kafka.network.BlockingChannel.receive(BlockingChannel.scala:131) at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:77) at kafka.producer.SyncProducer.kafka$producer$SyncProducer$doSend(SyncProducer.scala:74) at kafka.producer.SyncProducer.send(SyncProducer.scala:115) at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:59) at kafka.producer.BrokerPartitionInfo.updateInfo(BrokerPartitionInfo.scala:82) at kafka.producer.async.DefaultEventHandler$anonfun$handle$1.apply$mcV$sp(DefaultEventHandler.scala:68) at kafka.utils.CoreUtils$.swallow(CoreUtils.scala:89) at kafka.utils.Logging$class.swallowError(Logging.scala:106) at kafka.utils.CoreUtils$.swallowError(CoreUtils.scala:51) at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:68) at kafka.producer.Producer.send(Producer.scala:84) at kafka.javaapi.producer.Producer.send(Producer.scala:33) at com.hortonworks.tutorials.tutorial1.TruckEventsProducer.main(TruckEventsProducer.java:106)

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

New Contributor

Thank you very much for your reply. I have resolved this issue by changing listeners property in Kafka Broker section via Ambari from

PLAINTEXT://localhost:6667

To

PLAINTEXT://sandbox.hortonworks.com:6667

3 REPLIES 3

Re: Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

@yong yang

Did you set this? Make sure that you follow the tutorial step by step in sandbox.

  1. Configure Storm

You can check the below configurations by pasting them into the Filter text box under the Service Actions dropdown

  • Check zookeeper configuration: ensure storm.zookeeper.servers is set to sandbox.hortonworks.com

Re: Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

Mentor

@yong yang you need to make sure sandbox.Hortonworks.com is in your windows hosts file. Your windows needs to know such an address exists.

Find path for your OS version http://www.thewindowsclub.com/hosts-file-in-windows

Re: Java SocketTimeoutExpcetion is thrown when publishing message to Kafka from outside of HDP 2.3 sandbox.

New Contributor

Thank you very much for your reply. I have resolved this issue by changing listeners property in Kafka Broker section via Ambari from

PLAINTEXT://localhost:6667

To

PLAINTEXT://sandbox.hortonworks.com:6667