NullPointerException: Cannot start embedded cassandra

276 views
Skip to first unread message

Malte Bücken

unread,
Jan 21, 2015, 10:58:13 AM1/21/15
to spark-conn...@lists.datastax.com
I am writing my integration tests and try to start an embedded cassandra server:

abstract class GraphSpec extends WordSpec with MustMatchers with OptionValues with BeforeAndAfter with SharedEmbeddedCassandra

trait SharedEmbeddedCassandra extends EmbeddedCassandra {
def clearCache(): Unit = CassandraConnector.evictCache()
}

class GraphTest extends GraphSpec {
useCassandraConfig("cassandra.yaml")
...
}
and I always get:

java.lang.NullPointerException at
com.datastax.spark.connector.embedded.EmbeddedIO$class.closeAfterUse(Embedded.scala:26)

cassandra.yaml lies in test/resources/cassandra.yaml, but I tried various other locations including main resources

I run the test with sbt test. How do I get the embedded server to work?

Helena Edelson

unread,
Jan 21, 2015, 11:23:24 AM1/21/15
to spark-conn...@lists.datastax.com
Hi Malte,

I've seen that before when trying to use it outside the connector repo. I have a ticket somewhere to investigate that. It work for our IT tests.

I've created a new ticket https://datastax-oss.atlassian.net/browse/SPARKC-24.
Stay tuned...

Helena
@helenaedelson

Hugo Ferreira

unread,
Jan 22, 2015, 3:30:47 AM1/22/15
to spark-conn...@lists.datastax.com
Hello,

Had the same issue. Solved it by placing the file in the /conf directory in the root of my project. Maybe this will work for you too.

HTHs

Chad Retz

unread,
Jan 26, 2015, 1:13:33 PM1/26/15
to spark-conn...@lists.datastax.com
Placing in conf/ did not solve it for me. This is an issue with using the system classloader IMO. I have updated the JIRA issue.

vimal dinakaran

unread,
Jul 22, 2015, 7:15:52 AM7/22/15
to DataStax Spark Connector for Apache Cassandra

Hi All,
I am seeing the same issue . How did you guys resolve this ?

Eric Meisel

unread,
Mar 5, 2017, 11:35:03 AM3/5/17
to DataStax Spark Connector for Apache Cassandra

To those reading this and still have no idea what happened - you have to use the version layer to leverage your own cassandra.yaml file. The default version is 3, so put it in test/resources/3/

Reply all
Reply to author
Forward
0 new messages