com.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename

DataStax JIRA | Matt Jurik | 2 years ago
  1. 0

    We are seeing "InvalidQueryException: No keyspace has been specified." when using the java cassandra datastax driver version 2.1.4. The exceptions are quite rare, but do occur once every few days. Given the seemingly random nature of when they occur, I would guess it's some sort of race condition. *Most importantly, we always specify a keyspace when creating session objects.* The usage is straightfoward; the application creates two session objects (two different keyspaces), execute many millions of queries successfully, then perhaps a few days later we see "InvalidQueryException: No keyspace has been specified." stacktrace: {noformat} com.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename at com.datastax.driver.core.Responses$Error.asException(Responses.java:103) at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:140) at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:249) at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:421) at com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:697) at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296) at com.datastax.shaded.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:268) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:255) at com.datastax.shaded.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at com.datastax.shaded.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {noformat}

    DataStax JIRA | 2 years ago | Matt Jurik
    com.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename
  2. 0

    We are seeing "InvalidQueryException: No keyspace has been specified." when using the java cassandra datastax driver version 2.1.4. The exceptions are quite rare, but do occur once every few days. Given the seemingly random nature of when they occur, I would guess it's some sort of race condition. *Most importantly, we always specify a keyspace when creating session objects.* The usage is straightfoward; the application creates two session objects (two different keyspaces), execute many millions of queries successfully, then perhaps a few days later we see "InvalidQueryException: No keyspace has been specified." stacktrace: {noformat} com.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename at com.datastax.driver.core.Responses$Error.asException(Responses.java:103) at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:140) at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:249) at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:421) at com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:697) at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296) at com.datastax.shaded.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:268) at com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:255) at com.datastax.shaded.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at com.datastax.shaded.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {noformat}

    DataStax JIRA | 2 years ago | Matt Jurik
    com.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename
  3. 0

    When uploading a large dataset in Cassandra, I got a an _InvalidQueryException: no keyspace has been specified_. The exception seems to be related to a timeout on _Connection#setKeyspace_, which is ignored. To my understanding, the query is issued using a connection for which the keyspace has not been set, and the query fails, returning an _InvalidQueryException_. This is the service log: {code} 2014-08-14 10:51:33,865 WARN [Worker-0] com.datastax.driver.core.Connection - Timeout while setting keyspace on connection to cassandra-04.prod.visualdna.com/10.200.40.64:9042. This should not happen but is not critical (it will retried) 2014-08-14 10:51:34,379 WARN [Worker-0] com.datastax.driver.core.Connection - Timeout while setting keyspace on connection to cassandra-04.prod.visualdna.com/10.200.40.64:9042. This should not happen but is not critical (it will retried) 2014-08-14 10:51:34,889 WARN [Worker-0] com.datastax.driver.core.Connection - Timeout while setting keyspace on connection to cassandra-04.prod.visualdna.com/10.200.40.64:9042. This should not happen but is not critical (it will retried) 2014-08-14 10:51:35,405 WARN [Worker-0] com.datastax.driver.core.Connection - Timeout while setting keyspace on connection to cassandra-04.prod.visualdna.com/10.200.40.64:9042. This should not happen but is not critical (it will retried) com.datastax.driver.core.exceptions.InvalidQueryException: no keyspace has been specified at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:35) at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:256) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:172) at net.imagini.common.dao.cassandra.datastax.DatastaxCassandraDataAccess$AsyncOperationExecutor.tryGetFuture(DatastaxCassandraDataAccess.java:802) at net.imagini.common.dao.cassandra.datastax.DatastaxCassandraDataAccess$AsyncOperationExecutor.join(DatastaxCassandraDataAccess.java:784) at net.imagini.common.dao.cassandra.datastax.DatastaxCassandraDataAccess.executeBatchMutation(DatastaxCassandraDataAccess.java:267) at net.imagini.common.dao.cassandra.datastax.DatastaxCassandraDataAccess.executeMutation(DatastaxCassandraDataAccess.java:291) at net.imagini.sprinkler.workers.BaseCassandraWorker.commit(BaseCassandraWorker.java:146) at net.imagini.sprinkler.workers.BaseCassandraWorker.throttledCommit(BaseCassandraWorker.java:132) at net.imagini.sprinkler.workers.BaseCassandraWorker.processQueue(BaseCassandraWorker.java:93) at net.imagini.sprinkler.workers.BaseCassandraWorker.run(BaseCassandraWorker.java:58) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: no keyspace has been specified at com.datastax.driver.core.Responses$Error.asException(Responses.java:97) at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:108) at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:235) at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:367) at com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:571) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ... 3 more {code}

    DataStax JIRA | 2 years ago | Antonio Barbuzzi
    com.datastax.driver.core.exceptions.InvalidQueryException: no keyspace has been specified
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.datastax.driver.core.exceptions.InvalidQueryException

      No keyspace has been specified. USE a keyspace, or explicity specify keyspace.tablename

      at com.datastax.driver.core.Responses$Error.asException()
    2. DataStax Java Driver for Apache Cassandra - Core
      DeadLockProofWorker$1.run
      1. com.datastax.driver.core.Responses$Error.asException(Responses.java:103)
      2. com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:140)
      3. com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:249)
      4. com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:421)
      5. com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:697)
      6. com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
      7. com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
      8. com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
      9. com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296)
      10. com.datastax.shaded.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70)
      11. com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
      12. com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
      13. com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:296)
      14. com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
      15. com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
      16. com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
      17. com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
      18. com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
      19. com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
      20. com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:268)
      21. com.datastax.shaded.netty.channel.Channels.fireMessageReceived(Channels.java:255)
      22. com.datastax.shaded.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
      23. com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
      24. com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
      25. com.datastax.shaded.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
      26. com.datastax.shaded.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
      27. com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
      28. com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
      28 frames
    3. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames