cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Myrle Krantz <my...@apache.org>
Subject Re: ExceptionInInitializerError encountered during startup
Date Tue, 22 Aug 2017 14:48:28 GMT
On Tue, Aug 22, 2017 at 4:21 PM, Russell Bateman <russ@windofkeltia.com> wrote:
> As this was my first post to this forum, I wonder if someone would reply to
> it if only to prove to myself that I've not posted to /dev/null as it were
> even if there's no answer or the question is stupid, etc. (Note: I am
> getting other forum posts, but maybe what I've posted didn't reach the
> forum?)
>
> Profuse thanks,
>
> Russ

This will be my second post to this forum : o).  We're using embedded
Cassandra in our component tests as a junit ExternalResource, together
with datastax.  Here's some of what our start code looks like:
The original code can be found here:
https://github.com/mifosio/test/blob/develop/src/main/java/io/mifos/core/test/fixture/cassandra/CassandraInitializer.java

An example yaml file with the properties requested here can be found:
https://github.com/mifosio/portfolio/blob/develop/service/src/main/resources/application.yml

I use this hundreds of times a day and it works, but because our use
case is kind of special (multi-tenancy via keyspaces and multiple data
stores initialized as TestRules), you may have to noodle through what
we've done a bit to get your stuff working.

Greets,
Myrle

public final class CassandraInitializer {
  public void initialize() throws Exception {

    Builder clusterBuilder = (new
Builder()).withClusterName(System.getProperty("cassandra.clusterName"));
    ContactPointUtils.process(clusterBuilder,
System.getProperty("cassandra.contactPoints"));
    this.cluster = clusterBuilder.build();

    this.setup();
  }


  private void setup() throws Exception {
    if (!this.useExistingDB) {
      this.startEmbeddedCassandra();
      this.createKeyspaceSeshat();
    }

  }


  private void startEmbeddedCassandra() throws Exception {
    EmbeddedCassandraServerHelper.startEmbeddedCassandra(TimeUnit.SECONDS.toMillis(30L));
  }
}


> On 08/18/2017 05:49 PM, Russell Bateman wrote:
>
> Cassandra version 3.9, -unit version 3.1.3.2.
>
> In my (first ever) unit test, I've coded:
>
> @BeforeClass public static void initFakeCassandra() throws
> InterruptedException, IOException, TTransportException
> {
>     EmbeddedCassandraServerHelper.startEmbeddedCassandra( 20000L );
> }
>
> Execution crashes down inside at
>
>     at org.apache.cassandra.transport.Server.start(Server.java:128)
>     at java.util.Collections$SingletonSet.forEach(Collections.java:4767)
>     at
> org.apache.cassandra.service.NativeTransportService.start(NativeTransportService.java:128)
>     at
> org.apache.cassandra.service.CassandraDaemon.startNativeTransport(CassandraDaemon.java:649)
>     at
> org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:511)
>     at
> org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:616)
>     at
> org.cassandraunit.utils.EmbeddedCassandraServerHelper$1.run(EmbeddedCassandraServerHelper.java:129)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>     at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NullPointerException: name
>     at
> io.netty.util.internal.logging.AbstractInternalLogger.<init>(AbstractInternalLogger.java:39)
>     at
> io.netty.util.internal.logging.Slf4JLogger.<init>(Slf4JLogger.java:30)
>     at
> io.netty.util.internal.logging.Slf4JLoggerFactory.newInstance(Slf4JLoggerFactory.java:73)
>     at
> io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:84)
>     at
> io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:77)
>     at io.netty.bootstrap.ServerBootstrap.<clinit>(ServerBootstrap.java:46)
>     ... 10 more
>
> I am following the tutorial at Baeldung. Not sure where to go from here.
> Stackoverflow response was not helpful to me, I probably don't know enough
> yet.
>
> Thanks.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org


Mime
View raw message