2
votes

Am getting the following error code when trying to insert into Cassandra through Phantom from a Scala application.

Cassandra version is that bundled with: dsc-cassandra-3.0.1

[error] (run-main-0) com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces), localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect)) com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces), localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect))

I have read through other such questions in StackOverflow but have not found a resolution to my issue.

Additionally I have not noticed the presence of the following in any of the other error logs:

Am I correct in reading localhost/127.0.0.1:9042

Doesn't this boil down to 127.0.0.1/127.0.0.1:9402 - which would explain why it can't find the correct port opening.

Going down this track now, trying to figure out if that's a thing.

Have ensured Cassandra is running.

I also ran sudo lsof -i -P | grep -i "listen" with the following output (just pulling out the java ones):

java 4053 dan_mi_sun 85u IPv4 0xdbcce7039c377b9d 0t0 TCP localhost:7199 (LISTEN)
java 4053 dan_mi_sun 86u IPv4 0xdbcce703986952cd 0t0 TCP localhost:53680 (LISTEN)
java 4053 dan_mi_sun 92u IPv4 0xdbcce7039869b46d 0t0 TCP localhost:7002 (LISTEN)
java 4053 dan_mi_sun 145u IPv4 0xdbcce7039c37846d 0t0 TCP localhost:9042 (LISTEN)

Any thoughts on what the issue could be?

Have found this, but not sure if it is relevant:

https://datastax-oss.atlassian.net/browse/JAVA-897

In case it is of use here is the build.sbt

name := "SuperChain"

organization := "org.dyne.danielsan"

version := "0.1.0-SNAPSHOT"

scalaVersion := "2.11.7"

crossScalaVersions := Seq("2.10.4", "2.11.2")

resolvers ++= Seq(
  "Typesafe repository snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
  "Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/",
  "Sonatype repo"                    at "https://oss.sonatype.org/content/groups/scala-tools/",
  "Sonatype releases"                at "https://oss.sonatype.org/content/org.dyne.danielsan.superchain.data.cassandra.init.repositories/releases",
  "Sonatype snapshots"               at "https://oss.sonatype.org/content/org.dyne.danielsan.superchain.data.cassandra.init.repositories/snapshots",
  "Sonatype staging"                 at "http://oss.sonatype.org/content/org.dyne.danielsan.superchain.data.cassandra.init.repositories/staging",
  "Java.net Maven2 Repository"       at "http://download.java.net/maven/2/",
  "Twitter Repository"               at "http://maven.twttr.com",
  "Wedsudos Bintray Repo"            at "https://dl.bintray.com/websudos/oss-releases/"
)

libraryDependencies ++= Seq(
  "com.websudos" %% "phantom-dsl" % "1.12.2",
  "org.scalatest" %% "scalatest" % "2.2.1" % "test",
  "org.scalacheck" %% "scalacheck" % "1.11.5" % "test"
)

initialCommands := "import org.dyne.danielsan.superchain._"
1

1 Answers

2
votes

This error: com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces leads me to believe that the version of phantom you are using is not using datastax java-driver 3.0+. Since you are connecting to a 3.0 cluster, you need a 3.0 driver that understands the schema tables (system_schema.* instead of system.schema*). If you upgrade to phantom-dsl 1.21.0, that should fix the issue.