Java 无法通过Phantom连接到Cassandra(NoHostAvailableException)
我在尝试从Scala应用程序插入Cassandra时收到以下错误代码 Cassandra版本与:dsc-Cassandra-3.0.1捆绑在一起 [错误](run-main-0)com.datastax.driver.core.exceptions.NoHostAvailableException:所有尝试查询的主机均失败(尝试:localhost/127.0.0.1:9042(com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表架构_键空间),localhost/0:0:0:0:0:0:0:0:0:1:9042(com.datastax.driver.core.TransportException:[localhost/0:0:0:0:0:0:0:1:9042]无法连接) com.datastax.driver.core.exceptions.NoHostAvailableException:所有尝试查询的主机均失败(尝试:localhost/127.0.0.1:9042(com.datastax.driver.core.exceptions.InvalidQueryException:未配置的表架构_键空间),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]无法连接) 我已经阅读了StackOverflow中的其他此类问题,但尚未找到解决我的问题的方法 此外,我没有注意到任何其他错误日志中存在以下情况: 我读的Java 无法通过Phantom连接到Cassandra(NoHostAvailableException),java,scala,cassandra,datastax,phantom-dsl,Java,Scala,Cassandra,Datastax,Phantom Dsl,我在尝试从Scala应用程序插入Cassandra时收到以下错误代码 Cassandra版本与:dsc-Cassandra-3.0.1捆绑在一起 [错误](run-main-0)com.datastax.driver.core.exceptions.NoHostAvailableException:所有尝试查询的主机均失败(尝试:localhost/127.0.0.1:9042(com.datastax.driver.core.exceptions.InvalidQueryException:未
localhost/127.0.0.1:9042
这难道不能归结为127.0.0.1/127.0.0.1:9402
——这就解释了为什么它找不到正确的端口开口
现在沿着这条路走下去,试着弄清楚这是不是一件事
确保卡桑德拉在运行
我还使用以下输出运行了sudolsof-I-p | grep-I“listen”(仅拉出java输出):
你对这个问题有什么想法吗
已发现,但不确定是否相关:
如果需要,这里是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._"
此错误:
com.datastax.driver.core.exceptions.InvalidQueryException:unconfigured table schema_keyspaces
使我相信您使用的phantom版本没有使用datastax java driver 3.0+。由于您正在连接到一个3.0集群,因此需要一个了解架构表的3.0驱动程序(system_schema.*而不是system.schema*)。如果升级到phantom dsl 1.21.0,应该可以解决此问题
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._"