You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by cmbendre <ch...@zeotap.com> on 2017/10/25 10:39:16 UTC

Not able to connect to Phoenix Queryserver from Spark

I am trying to connect to Phoenix queryserver from Spark. Following Scala
code works perfectly fine when i run it without spark.

*import java.sql.{Connection, DriverManager, PreparedStatement, ResultSet,
Statement}
Class.forName("org.apache.phoenix.queryserver.client.Driver")
val connection=
DriverManager.getConnection("jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF");
val statement = connection.createStatement()*

But the same code fails with following exception in Spark Shell / Spark
Submit -

/java.lang.RuntimeException: response code 500
  at
org.apache.calcite.avatica.remote.RemoteService.apply(RemoteService.java:45)
  at
org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:235)
  at
org.apache.calcite.avatica.remote.RemoteMeta.connectionSync(RemoteMeta.java:97)
  at
org.apache.calcite.avatica.remote.RemoteMeta.createStatement(RemoteMeta.java:65)
  at
org.apache.calcite.avatica.AvaticaStatement.<init>(AvaticaStatement.java:83)
  at
org.apache.calcite.avatica.AvaticaJdbc41Factory$AvaticaJdbc41Statement.<init>(AvaticaJdbc41Factory.java:114)
  at
org.apache.calcite.avatica.AvaticaJdbc41Factory.newStatement(AvaticaJdbc41Factory.java:73)
  at
org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:263)
  at
org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:110)
  at
org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:51)
  ... 48 elided/

I am using Spark 2.1.0 along with Phoenix 4.11 with HBase 1.3. 

I could not find any similar error on the internet. Please help.





--
Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/

Re: Not able to connect to Phoenix Queryserver from Spark

Posted by Josh Elser <el...@apache.org>.
I don't know why running it inside of Spark would cause issues.

I would double-check the classpath of your application when running in 
Spark as well as look at the PQS log (HTTP/500 is a server error).

On 10/25/17 6:39 AM, cmbendre wrote:
> I am trying to connect to Phoenix queryserver from Spark. Following Scala
> code works perfectly fine when i run it without spark.
> 
> *import java.sql.{Connection, DriverManager, PreparedStatement, ResultSet,
> Statement}
> Class.forName("org.apache.phoenix.queryserver.client.Driver")
> val connection=
> DriverManager.getConnection("jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF");
> val statement = connection.createStatement()*
> 
> But the same code fails with following exception in Spark Shell / Spark
> Submit -
> 
> /java.lang.RuntimeException: response code 500
>    at
> org.apache.calcite.avatica.remote.RemoteService.apply(RemoteService.java:45)
>    at
> org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:235)
>    at
> org.apache.calcite.avatica.remote.RemoteMeta.connectionSync(RemoteMeta.java:97)
>    at
> org.apache.calcite.avatica.remote.RemoteMeta.createStatement(RemoteMeta.java:65)
>    at
> org.apache.calcite.avatica.AvaticaStatement.<init>(AvaticaStatement.java:83)
>    at
> org.apache.calcite.avatica.AvaticaJdbc41Factory$AvaticaJdbc41Statement.<init>(AvaticaJdbc41Factory.java:114)
>    at
> org.apache.calcite.avatica.AvaticaJdbc41Factory.newStatement(AvaticaJdbc41Factory.java:73)
>    at
> org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:263)
>    at
> org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:110)
>    at
> org.apache.calcite.avatica.AvaticaConnection.createStatement(AvaticaConnection.java:51)
>    ... 48 elided/
> 
> I am using Spark 2.1.0 along with Phoenix 4.11 with HBase 1.3.
> 
> I could not find any similar error on the internet. Please help.
> 
> 
> 
> 
> 
> --
> Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/
>