adejanovski / cassandra-jdbc-wrapper

A JDBC wrapper for the Datastax Java Driver for Cassandra
Apache License 2.0
53 stars 36 forks source link

duplicate map key in CassandraDriver.connect() #2

Closed kianchai closed 8 years ago

kianchai commented 8 years ago

Hi. Thanks for writing this wrapper. I encountered a problem when trying to use the driver in Solr.

Caused by: java.lang.IllegalArgumentException: duplicate key: url at com.github.adejanovski.cassandra.jdbc.CassandraDriver.connect(CassandraDriver.java:97)

For reference, my Solr data-config.xml consist of this: <dataSource type="JdbcDataSource" driver="com.github.adejanovski.cassandra.jdbc.CassandraDriver" url="jdbc:cassandra://127.0.0.1:9042/mykeyspace" autoCommit="true" />

Looks like the "url" of the dataSource is causing it.

Cheers!

adejanovski commented 8 years ago

Hi @kianchai ,

the url key is indeed already used in the code. I've switched it to another name to avoid conflicts. Could you please test with this 3.0.1-beta jar before I push the code ?

Thanks

kianchai commented 8 years ago

Thanks for the quick response!

My cassandra is v2, may have a problem with the 3 drivers. I am able to connect now, so your fix should be ok. I am getting this error: com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [varint <-> java.lang.Integer] which I think is a cassandra driver compatibility problem.

Would be great if you have a version for 2.x :)

Cheers!

adejanovski commented 8 years ago

The underlying Datastax Java driver works with Cassandra from 1.2 to 3.x : http://datastax.github.io/java-driver/manual/native_protocol/

You should have no problem using the 3.0.1-beta version with your 2.x cluster.

Let me know how the fix works so that I can close the issue.

kianchai commented 8 years ago

The fix is OK, as it went passed the connection phase successfully. Thank you very much.