com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of bind variables

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I tried creating a repository method with parameters but it seems that it doesn't work. This is the following query I wanted: {code} @Query(SELECT * FROM foo WHERE p1 = :p1 AND p2 = :p2 AND p3 = :p3) Set<Foo> findByPartitionKey(@Param("p1") final double p1, @Param("p2") final double p2, @Param("p3") final String p3); {code} Here is the stacktrace for the above query: {code} com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of bind variables at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:35) at com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException(ResultSetFuture.java:269) at com.datastax.driver.core.ResultSetFuture.getUninterruptibly(ResultSetFuture.java:183) at com.datastax.driver.core.Session.execute(Session.java:111) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:519) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:487) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:499) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:409) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:436) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:430) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:122) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1408.findByPartitionKey(Unknown Source) {code} Also tried indexes instead of bind parameter names {code} @Query(SELECT * FROM foo WHERE p1 = ?1 AND p2 = ?2 AND p3 = ?3) Set<Foo> findByPartitionKey(final double p1, final double p2, final String p3); {code} The above query gave me the following stacktrace: {code} org.springframework.data.repository.query.ParameterOutOfBoundsException: Invalid parameter index! You seem to have declare too little query method parameters! at org.springframework.data.repository.query.Parameters.getParameter(Parameters.java:179) at org.springframework.data.repository.query.Parameters.getBindableParameter(Parameters.java:249) at org.springframework.data.repository.query.ParametersParameterAccessor.getBindableValue(ParametersParameterAccessor.java:107) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.getParameterWithIndex(StringBasedCassandraQuery.java:48) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.replacePlaceholders(StringBasedCassandraQuery.java:41) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.createQuery(StringBasedCassandraQuery.java:30) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:120) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1486.findByPartitionKey(Unknown Source) Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at org.springframework.data.repository.query.Parameters.getParameter(Parameters.java:177) ... 38 more {code}
    via by Colin McQueen,
  • I tried creating a repository method with parameters but it seems that it doesn't work. This is the following query I wanted: {code} @Query(SELECT * FROM foo WHERE p1 = :p1 AND p2 = :p2 AND p3 = :p3) Set<Foo> findByPartitionKey(@Param("p1") final double p1, @Param("p2") final double p2, @Param("p3") final String p3); {code} Here is the stacktrace for the above query: {code} com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of bind variables at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:35) at com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException(ResultSetFuture.java:269) at com.datastax.driver.core.ResultSetFuture.getUninterruptibly(ResultSetFuture.java:183) at com.datastax.driver.core.Session.execute(Session.java:111) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:519) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:487) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:499) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:409) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:436) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:430) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:122) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1408.findByPartitionKey(Unknown Source) {code} Also tried indexes instead of bind parameter names {code} @Query(SELECT * FROM foo WHERE p1 = ?1 AND p2 = ?2 AND p3 = ?3) Set<Foo> findByPartitionKey(final double p1, final double p2, final String p3); {code} The above query gave me the following stacktrace: {code} org.springframework.data.repository.query.ParameterOutOfBoundsException: Invalid parameter index! You seem to have declare too little query method parameters! at org.springframework.data.repository.query.Parameters.getParameter(Parameters.java:179) at org.springframework.data.repository.query.Parameters.getBindableParameter(Parameters.java:249) at org.springframework.data.repository.query.ParametersParameterAccessor.getBindableValue(ParametersParameterAccessor.java:107) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.getParameterWithIndex(StringBasedCassandraQuery.java:48) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.replacePlaceholders(StringBasedCassandraQuery.java:41) at org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery.createQuery(StringBasedCassandraQuery.java:30) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:120) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1486.findByPartitionKey(Unknown Source) Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at org.springframework.data.repository.query.Parameters.getParameter(Parameters.java:177) ... 38 more {code}
    via by Colin McQueen,
  • GitHub comment 12#37273045
    via GitHub by pyr
    ,
  • Datastax Java Driver | Page number 2 | NGXO
    via by Unknown author,
  • I am trying to create a little tool for handling schema-migrations of a cassandra keyspace. I have five scripts, 1. create keyspace user_profile WITH replication = {'class': 'SimpleStrategy' , 'replication_factor': 3}; 2. create table migration_events (id varchar, state varchar, output varchar, PRIMARY KEY (id)) 3. create index migrationStateIdx on migration_events (state) 4. write output/state of script 1-3 to migration_events (if ok) 4. create table user_profile 4.1 write state to migration_events 5. create table user_history 5.1 write state to migration events. On every create table I get this msg: {noformat} ERROR [2013-04-22 09:55:19,374] com.datastax.driver.core.Cluster: Error during schema refresh (peer is not a column defined in this metadata). The schema from Cluster.getMetadata() might appear stale. Asynchronously submitting job to fix. {noformat} in C* log (1.2.4) I see this (for every create table): {noformat} INFO [MigrationStage:1] 2013-04-22 11:55:15,331 ColumnFamilyStore.java (line 631) Enqueuing flush of Memtable-schema_columnfamilies@1624257196(1315/4043 serialized/live bytes, 20 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,331 Memtable.java (line 453) Writing Memtable-schema_columnfamilies@1624257196(1315/4043 serialized/live bytes, 20 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,351 Memtable.java (line 487) Completed flushing /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-ib-83-Data.db (725 bytes) for commitlog position ReplayPosition(segmentId=1366187132442, position=16333535) INFO [MigrationStage:1] 2013-04-22 11:55:15,352 ColumnFamilyStore.java (line 631) Enqueuing flush of Memtable-schema_columns@2013182698(337/1075 serialized/live bytes, 5 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,353 Memtable.java (line 453) Writing Memtable-schema_columns@2013182698(337/1075 serialized/live bytes, 5 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,373 Memtable.java (line 487) Completed flushing /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-83-Data.db (260 bytes) for commitlog position ReplayPosition(segmentId=1366187132442, position=16333535) {noformat} When debugging and stepping slowly over each create statement, my migration setup works, but when running at "full speed" the tables I create aren't discovered, most likely with this error: {noformat} Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily migration_events at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:32) at com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException(ResultSetFuture.java:234) at com.datastax.driver.core.ResultSetFuture.getUninterruptibly(ResultSetFuture.java:165) at com.datastax.driver.core.Session.execute(Session.java:106) at com.datastax.driver.core.Session.execute(Session.java:75) at com.vimond.micro.profile.core.CassandraDriverWrapper.createKeyspaceAndTryAgain(CassandraDriverWrapper.java:130) {noformat} Also, when these errors appear my migrations-program (a standalone java program through dropwizard) won't shut down. Clearly the 'Asynchronously submitting job to fix.' has not finished yet. Actually I have never seen it finished. The attached thread dump is from a program waiting for 15 minutes. When I set the prog to sleep after each creation the program exits cleanly.
    via by Olve S. Hansen,
  • I am trying to create a little tool for handling schema-migrations of a cassandra keyspace. I have five scripts, 1. create keyspace user_profile WITH replication = {'class': 'SimpleStrategy' , 'replication_factor': 3}; 2. create table migration_events (id varchar, state varchar, output varchar, PRIMARY KEY (id)) 3. create index migrationStateIdx on migration_events (state) 4. write output/state of script 1-3 to migration_events (if ok) 4. create table user_profile 4.1 write state to migration_events 5. create table user_history 5.1 write state to migration events. On every create table I get this msg: {noformat} ERROR [2013-04-22 09:55:19,374] com.datastax.driver.core.Cluster: Error during schema refresh (peer is not a column defined in this metadata). The schema from Cluster.getMetadata() might appear stale. Asynchronously submitting job to fix. {noformat} in C* log (1.2.4) I see this (for every create table): {noformat} INFO [MigrationStage:1] 2013-04-22 11:55:15,331 ColumnFamilyStore.java (line 631) Enqueuing flush of Memtable-schema_columnfamilies@1624257196(1315/4043 serialized/live bytes, 20 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,331 Memtable.java (line 453) Writing Memtable-schema_columnfamilies@1624257196(1315/4043 serialized/live bytes, 20 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,351 Memtable.java (line 487) Completed flushing /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-ib-83-Data.db (725 bytes) for commitlog position ReplayPosition(segmentId=1366187132442, position=16333535) INFO [MigrationStage:1] 2013-04-22 11:55:15,352 ColumnFamilyStore.java (line 631) Enqueuing flush of Memtable-schema_columns@2013182698(337/1075 serialized/live bytes, 5 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,353 Memtable.java (line 453) Writing Memtable-schema_columns@2013182698(337/1075 serialized/live bytes, 5 ops) INFO [FlushWriter:23] 2013-04-22 11:55:15,373 Memtable.java (line 487) Completed flushing /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-83-Data.db (260 bytes) for commitlog position ReplayPosition(segmentId=1366187132442, position=16333535) {noformat} When debugging and stepping slowly over each create statement, my migration setup works, but when running at "full speed" the tables I create aren't discovered, most likely with this error: {noformat} Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily migration_events at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:32) at com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException(ResultSetFuture.java:234) at com.datastax.driver.core.ResultSetFuture.getUninterruptibly(ResultSetFuture.java:165) at com.datastax.driver.core.Session.execute(Session.java:106) at com.datastax.driver.core.Session.execute(Session.java:75) at com.vimond.micro.profile.core.CassandraDriverWrapper.createKeyspaceAndTryAgain(CassandraDriverWrapper.java:130) {noformat} Also, when these errors appear my migrations-program (a standalone java program through dropwizard) won't shut down. Clearly the 'Asynchronously submitting job to fix.' has not finished yet. Actually I have never seen it finished. The attached thread dump is from a program waiting for 15 minutes. When I set the prog to sleep after each creation the program exits cleanly.
    via by Olve S. Hansen,
    • com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of bind variables at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:35) at com.datastax.driver.core.ResultSetFuture.extractCauseFromExecutionException(ResultSetFuture.java:269) at com.datastax.driver.core.ResultSetFuture.getUninterruptibly(ResultSetFuture.java:183) at com.datastax.driver.core.Session.execute(Session.java:111) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:519) at org.springframework.cassandra.core.CqlTemplate$12.doInSession(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:487) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:510) at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:499) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:409) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:436) at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:430) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:122) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1408.findByPartitionKey(Unknown Source)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    xenji
    xenji1 times, last one,
    6 more bugmates