cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Cobley <acob...@computing.dundee.ac.uk>
Subject Re: JDBC, Select * Cql2 vs Cql3 problem ?
Date Tue, 29 Jan 2013 13:50:53 GMT
When connecting to Cassandra 1.2.0 from CQLSH the table was created with:

CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor' :
1};
cqlsh> use test;
cqlsh:test> create columnfamily users (KEY varchar Primary key, password varchar, gender
varchar) ;
cqlsh:test> INSERT INTO users (KEY, password) VALUES ('jsmith', 'ch@ngem3a');
cqlsh:test> INSERT INTO users (KEY, gender) VALUES ('jbrown', 'male');

stack trace (generated et.printStackTrace()) is:

Can not execute statement java.lang.NullPointerException
	at org.apache.cassandra.cql.jdbc.TypedColumn.<init>(TypedColumn.java:45)
	at org.apache.cassandra.cql.jdbc.CassandraResultSet.createColumn(CassandraResultSet.java:972)
	at org.apache.cassandra.cql.jdbc.CassandraResultSet.populateColumns(CassandraResultSet.java:156)
	at org.apache.cassandra.cql.jdbc.CassandraResultSet.<init>(CassandraResultSet.java:130)
	at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:167)
	at org.apache.cassandra.cql.jdbc.CassandraStatement.executeQuery(CassandraStatement.java:227)
	at uk.ac.dundee.computing.aec.test.test.doGet(test.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

Hope that helps !

Andy


On 29 Jan 2013, at 07:17, aaron morton <aaron@thelastpickle.com> wrote:

> What is your table spec ? 
> Do you have the full stack trace from the exception ? 
> 
> Cheers
> 
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
> 
> @aaronmorton
> http://www.thelastpickle.com
> 
> On 29/01/2013, at 8:15 AM, Andy Cobley <acobley@computing.dundee.ac.uk> wrote:
> 
>> I have the following code in my app using the JDBC (cassandra-jdbc-1.1.2.jar) drivers
to CQL:
>> 
>> try {
>> 	rs= stmt.executeQuery("SELECT * FROM users");
>> }catch(Exception et){
>> 	System.out.println("Can not execute statement "+et);
>> }
>> 
>> When connecting to a CQL2 server (cassandra 1.1.5) the code works as expected returning
a result set .  When connecting to CQL3 (Cassandra 1.2) I catch the following exception:
>> 
>> Can not execute statement java.lang.NullPointerException
>> 
>> The Select statement (Select * from users) does work from CQLSH as expected.  Is
there a problem with my code or something else ?
>> 
>> Andy C
>> School of Computing
>> University of Dundee.
>> 
>> 
>> 
>> The University of Dundee is a Scottish Registered Charity, No. SC015096.
> 


The University of Dundee is a Scottish Registered Charity, No. SC015096.



Mime
View raw message