Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Apache phoenix 4.5.1 with spark 1.3.1 Classnotfoundexception

New Contributor

We are running spark streaming to get the feed from Kafka. Now we are trying to use Phoenix JDBC to extract some data from HBASE. When I run the code in local its running fine without any issues, but when I run it using yarn-cluster it throws below exception. Using CDH 5.4.4.


Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.ipc.controller.ClientRpcControllerFactory
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(


Below is the code snippet:


def check(arg0:String,arg1:String)
  val query = "query"

    var conn =  DriverManager.getConnection("jdbc:phoenix:IP:zkport:/znode");
        val statement = conn.createStatement()
        val resultSet = statement.executeQuery(query)
        var out="";


And the SBT dependency added is


libraryDependencies += "org.apache.phoenix" % "phoenix-core" % "4.5.2-cdh5.4.5"


I manually checked for the missing class, and it is there in phoenix-core jar. What is the reason behind yarn/spark throwing an exception. I tried adding it as a separate classpath that doesn't work either. Any workaround for this.



New Contributor

Adding phoenix-core to classpath.txt worked. But a weird issue.

View solution in original post




           are you using the Phonex Clab ? What  is the version of it ?



Kind Regards

New Contributor

Yes, 4.5.2-cdh5.4.5 is the one in my dependency. Got that from cloudera repo

New Contributor

Adding phoenix-core to classpath.txt worked. But a weird issue.

New Contributor

I am getting the same error when I try to load a phoenix table into Spark DataFrame. Have you come across same issue with dataframes?

New Contributor

Not with dataframes but i think it is a collon issue with phoenix+spark streaming. You can try adding the jars to classpath and execute

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.