json - Datastax cassandra QueryBuilder insertion error (java) -


environment :

  • java 7

  • cassandra 2.1.2 running on local dev workstation in 1 simple node on windows 8.1

  • driver cassandra-driver-core-2.1.2

  • running environment : apache karaf 2.3.8

i try insert row giving json in column defined simple type (coordinates x , y).

i build java statement :

statement statement = querybuilder .insertinto("mykeyspace", "mytable") .value("mykeycolumn", "mykeyvalue") .value("coordinates", "{\"x\":10.4,\"y\":20.3}"); 

and when executing :

mysession.execute(statement); 

i've got following error (full stack trace @ end of message) :

com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1] 

[in following cql statements, have anonymized column names, possible quotes wrong, problem in java statement above]

my cassandra table , type :

create table if not exists "mytable" (      "mykeycolumn" text,     coordinates frozen<coordinates>,     primary key ("mykeycolumn")  );  create type if not exists coordinates (       x double,       y double ); 

and when executing following query in datastax devcenter, works fine :

insert "mytable"("mykeycolumn","coordinates") values ('mykeyvalue',{"x":10.4,"y":20.3}); 

any welcome ! :-)

full stack trace :

2014-11-27 11:38:07,532 | warn  | tp1271566160-230 | servlethandler                   | pse.jetty.servlet.servlethandler  563 | 135 - org.eclipse.jetty.aggregate.jetty-all-server - 8.1.15.v20140411 | /cxf/rest/myproject/add java.lang.runtimeexception: org.apache.cxf.interceptor.fault: com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1]     @ org.apache.cxf.interceptor.abstractfaultchaininitiatorobserver.onmessage(abstractfaultchaininitiatorobserver.java:116)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:336)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.transport.chaininitiationobserver.onmessage(chaininitiationobserver.java:121)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.transport.http.abstracthttpdestination.invoke(abstracthttpdestination.java:241)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.servletcontroller.invokedestination(servletcontroller.java:248)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.servletcontroller.invoke(servletcontroller.java:222)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.servletcontroller.invoke(servletcontroller.java:153)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.cxfnonspringservlet.invoke(cxfnonspringservlet.java:171)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.abstracthttpservlet.handlerequest(abstracthttpservlet.java:286)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.apache.cxf.transport.servlet.abstracthttpservlet.dopost(abstracthttpservlet.java:206)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ javax.servlet.http.httpservlet.service(httpservlet.java:595)[83:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0]     @ org.apache.cxf.transport.servlet.abstracthttpservlet.service(abstracthttpservlet.java:262)[171:org.apache.cxf.cxf-rt-transports-http:2.7.12]     @ org.eclipse.jetty.servlet.servletholder.handle(servletholder.java:684)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.servlet.servlethandler.dohandle(servlethandler.java:503)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.ops4j.pax.web.service.jetty.internal.httpserviceservlethandler.dohandle(httpserviceservlethandler.java:69)[145:org.ops4j.pax.web.pax-web-jetty:3.1.1]     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:137)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.security.securityhandler.handle(securityhandler.java:557)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.session.sessionhandler.dohandle(sessionhandler.java:231)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.handler.contexthandler.dohandle(contexthandler.java:1086)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.ops4j.pax.web.service.jetty.internal.httpservicecontext.dohandle(httpservicecontext.java:240)[145:org.ops4j.pax.web.pax-web-jetty:3.1.1]     @ org.eclipse.jetty.servlet.servlethandler.doscope(servlethandler.java:429)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.session.sessionhandler.doscope(sessionhandler.java:193)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.handler.contexthandler.doscope(contexthandler.java:1020)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:135)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.ops4j.pax.web.service.jetty.internal.jettyserverhandlercollection.handle(jettyserverhandlercollection.java:77)[145:org.ops4j.pax.web.pax-web-jetty:3.1.1]     @ org.eclipse.jetty.server.handler.handlerwrapper.handle(handlerwrapper.java:116)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.server.handle(server.java:370)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.abstracthttpconnection.handlerequest(abstracthttpconnection.java:494)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.abstracthttpconnection.content(abstracthttpconnection.java:982)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.abstracthttpconnection$requesthandler.content(abstracthttpconnection.java:1043)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.http.httpparser.parsenext(httpparser.java:865)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.http.httpparser.parseavailable(httpparser.java:240)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.server.asynchttpconnection.handle(asynchttpconnection.java:82)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.io.nio.selectchannelendpoint.handle(selectchannelendpoint.java:696)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.io.nio.selectchannelendpoint$1.run(selectchannelendpoint.java:53)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.util.thread.queuedthreadpool.runjob(queuedthreadpool.java:608)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ org.eclipse.jetty.util.thread.queuedthreadpool$3.run(queuedthreadpool.java:543)[135:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]     @ java.lang.thread.run(thread.java:724)[:1.7.0_25] caused by: org.apache.cxf.interceptor.fault: com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1]     @ org.apache.cxf.service.invoker.abstractinvoker.createfault(abstractinvoker.java:170)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.service.invoker.abstractinvoker.invoke(abstractinvoker.java:136)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.jaxrs.jaxrsinvoker.invoke(jaxrsinvoker.java:204)[177:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.12]     @ org.apache.cxf.jaxrs.jaxrsinvoker.invoke(jaxrsinvoker.java:101)[177:org.apache.cxf.cxf-rt-frontend-jaxrs:2.7.12]     @ org.apache.cxf.interceptor.serviceinvokerinterceptor$1.run(serviceinvokerinterceptor.java:58)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.interceptor.serviceinvokerinterceptor.handlemessage(serviceinvokerinterceptor.java:94)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:272)[164:org.apache.cxf.cxf-api:2.7.12]     ... 36 more caused by: org.mycompany.service.container.invocationexception: com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1]     @ org.mycompany.service.container.interceptors.serviceinterceptor.invoke(serviceinterceptor.java:73)     @ org.mycompany.service.container.invocationchain.invokenext(invocationchain.java:82)     @ org.mycompany.service.container.interceptors.securityinterceptor.invoke(securityinterceptor.java:84)     @ org.mycompany.service.container.invocationchain.invokenext(invocationchain.java:82)     @ org.mycompany.service.container.serviceinvocationhandler.invoke(serviceinvocationhandler.java:66)     @ com.sun.proxy.$proxy24.add(unknown source)     @ sun.reflect.generatedmethodaccessor74.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)[:1.7.0_25]     @ java.lang.reflect.method.invoke(method.java:606)[:1.7.0_25]     @ org.apache.cxf.service.invoker.abstractinvoker.performinvocation(abstractinvoker.java:188)[164:org.apache.cxf.cxf-api:2.7.12]     @ org.apache.cxf.service.invoker.abstractinvoker.invoke(abstractinvoker.java:104)[164:org.apache.cxf.cxf-api:2.7.12]     ... 41 more caused by: com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1]     @ com.datastax.driver.core.exceptions.invalidqueryexception.copy(invalidqueryexception.java:35)     @ com.datastax.driver.core.defaultresultsetfuture.extractcausefromexecutionexception(defaultresultsetfuture.java:258)     @ com.datastax.driver.core.defaultresultsetfuture.getuninterruptibly(defaultresultsetfuture.java:174)     @ com.datastax.driver.core.abstractsession.execute(abstractsession.java:52)     @ mypackage.data.internal.mydao.add(mydao.java:140)     ... 51 more caused by: com.datastax.driver.core.exceptions.invalidqueryexception: not enough bytes read 0th field java.nio.heapbytebuffer[pos=0 lim=1 cap=1]     @ com.datastax.driver.core.responses$error.asexception(responses.java:97)[120:com.datastax.driver.core:2.1.0]     @ com.datastax.driver.core.defaultresultsetfuture.onset(defaultresultsetfuture.java:110)[120:com.datastax.driver.core:2.1.0]     @ com.datastax.driver.core.requesthandler.setfinalresult(requesthandler.java:235)[120:com.datastax.driver.core:2.1.0]     @ com.datastax.driver.core.requesthandler.onset(requesthandler.java:367)[120:com.datastax.driver.core:2.1.0]     @ com.datastax.driver.core.connection$dispatcher.messagereceived(connection.java:584)[120:com.datastax.driver.core:2.1.0]     @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercontext.sendupstream(defaultchannelpipeline.java:791)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:296)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.handler.codec.oneone.onetoonedecoder.handleupstream(onetoonedecoder.java:70)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercontext.sendupstream(defaultchannelpipeline.java:791)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:296)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.handler.codec.oneone.onetoonedecoder.handleupstream(onetoonedecoder.java:70)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercontext.sendupstream(defaultchannelpipeline.java:791)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:296)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.handler.codec.frame.framedecoder.unfoldandfiremessagereceived(framedecoder.java:462)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.handler.codec.frame.framedecoder.calldecode(framedecoder.java:443)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.handler.codec.frame.framedecoder.messagereceived(framedecoder.java:303)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.simplechannelupstreamhandler.handleupstream(simplechannelupstreamhandler.java:70)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:564)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.defaultchannelpipeline.sendupstream(defaultchannelpipeline.java:559)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:268)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.channels.firemessagereceived(channels.java:255)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.socket.nio.nioworker.read(nioworker.java:88)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.socket.nio.abstractnioworker.process(abstractnioworker.java:108)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.socket.nio.abstractnioselector.run(abstractnioselector.java:318)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.socket.nio.abstractnioworker.run(abstractnioworker.java:89)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.channel.socket.nio.nioworker.run(nioworker.java:178)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.util.threadrenamingrunnable.run(threadrenamingrunnable.java:108)[118:org.jboss.netty:3.9.3.final]     @ org.jboss.netty.util.internal.deadlockproofworker$1.run(deadlockproofworker.java:42)[118:org.jboss.netty:3.9.3.final]     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)[:1.7.0_25]     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)[:1.7.0_25]     ... 1 more 

there known issue udts in driver v2.1.2 addressed in v2.1.3. in meantime try workaround given here:

https://datastax-oss.atlassian.net/browse/java-500

as in:

cluster.builder().withprotocolversion(protocolversion.v3) 

and see if helps


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -