You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "ArunaSai.Kannamareddy" <Ar...@target.com> on 2017/09/29 01:03:05 UTC

Issue using Kafka ZkUtils

Hello Team,

I have the below issue with Kafka ZkUtils API. When I am trying to debug intelliJ points me to the ZkUtils class but when
I tried to use it, the methods listed under ZkUtils object only pop up in the auto-suggestions.

    import kafka.utils.{TestUtils, ZKStringSerializer, ZkUtils}
    import org.I0Itec.zkclient.{ZkClient, ZkConnection}
    import kafka.utils.ZkUtils._

    var zkUtils: ZkUtils = _
    //val zkConnection= new ZkConnection(zkConn)
    //zkClient = new ZkClient(zkConn,5000,5000,ZKStringSerializer)
    //val zkUtils = new ZkUtils(zkClient, zkConnection, false)
    val (zkClient, zkConnection) = ZkUtils.createZkClientAndConnection(
      zkConn, sessionTimeoutMs, connectionTimeoutMs)
    zkUtils = new ZkUtils(zkClient, zkConnection, false)

I am trying to create a ZkUtils object but facing issues. My Gradle build is successful but when I try to run the test file, face the below issues

Error:(27, 16) not found: type ZkUtils
  var zkUtils: ZkUtils = _
Error:(44, 44) value createZkClientAndConnection is not a member of object kafka.utils.ZkUtils
    val (zkClient, zkConnection) = ZkUtils.createZkClientAndConnection(
Error:(46, 20) not found: type ZkUtils
     zkUtils = new ZkUtils(zkClient, zkConnection, false)

I have the following dependencies in my gradle build file as well.

  compile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1', classifier:'test'
    compile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1'
    testCompile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1', classifier:'test'
    testCompile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1'

Can anyone tell me what’s going wrong here. Thanks for your help.

Thanks,
Aruna.