当我在第一步尝试Cassandra的Playlist tutorial时,我遇到了一个异常。我在Google Compute Engine上创建了一个VM,并安装了cassandra 3.0.10(this link)。然后我按照教程中的要求做了。
Caused by: 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))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:240)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:86)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1455)
at com.datastax.driver.core.Cluster.init(Cluster.java:158)
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:329)
at com.datastax.driver.core.Cluster.connect(Cluster.java:279)
at playlist.model.CassandraData.createSession(CassandraData.java:66)
at playlist.model.CassandraData.getSession(CassandraData.java:50)
at playlist.model.CassandraInfo.<init>(CassandraInfo.java:25)
at playlist.controller.HomeServlet.doGet(HomeServlet.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:595)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:191)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:72)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:742)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:712)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
... 38 more
有人说com.datastax.cassandra的版本和Cassandra不匹配,在pom.xml中,com.datastax.cassandra的版本是2.1.10,虽然我把它改成了3.1.0,但还是出现了异常。
我应该采用哪个版本的com.datastax.cassandra?
顺便说一句,我可以使用com.datastax.cassandra3.1.0访问Cassandra3.7,但是使用com.datastax.cassandra2.1.10访问Cassandra3.7会出现同样的异常。
1条答案
按热度按时间nue99wik1#
问题确实是版本的不一致。当我使用
Tomcat
部署这个应用程序时,我可以成功地从web浏览器访问它。但是使用教程中采用的cargo
对我不起作用。我对它不熟悉。可能我做错了什么。