异常或错误导致 运行 中止:无法启动 EmbeddedCassandra[name='cassandra-2', version='3.11.6']
An exception or error caused a run to abort: Unable to start EmbeddedCassandra[name='cassandra-2', version='3.11.6']
我在单元测试 (Scalatest) 中使用 embedded-cassandra
。当我尝试 运行 所有测试用例作为批处理时,出现错误
An exception or error caused a run to abort: Unable to start EmbeddedCassandra[name='cassandra-2', version='3.11.6']
...
Caused by: java.io.IOException: 'WindowsCassandraNode[pid='-1', exitValue='0']' is not alive. Please see logs for more details
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file C:\Users\manuc\AppData\Local\Temp\apache-cassandra-3.11.6-5333812070060739596/logs/gc.log due to No such file or directory
...
ava.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind
ERROR [main] 2020-09-17 06:27:11,872 CassandraDaemon.java:774 - Port already in use: 7199; nested exception is:
我可能做错了什么?正如跟踪所说 cassandra-2
,Cassandra 的另一个实例似乎已经 运行ning?难道测试是同时进行的 运行ning 吗? 运行在Intellij/Scalatest
中串行测试的方法是什么?
这个答案提到 Scalatest 会 运行 并行执行,这可能会导致端口冲突问题。有没有办法避免 embedded-cassandra
或 运行 系列中的端口冲突? - How to run tests in a class sequentially in ScalaTest?
您可以尝试使用随机端口来解决您的问题:
EmbeddedCassandraFactory cassandraFactory = new EmbeddedCassandraFactory();
cassandraFactory.setPort(0);
cassandraFactory.setSslPort(0); // if SSL client options enabled
cassandraFactory.setRpcPort(0);
cassandraFactory.setJmxLocalPort(0);
cassandraFactory.setStoragePort(0);
cassandraFactory.setSslStoragePort(0); // // if SSL server options enabled
我在单元测试 (Scalatest) 中使用 embedded-cassandra
。当我尝试 运行 所有测试用例作为批处理时,出现错误
An exception or error caused a run to abort: Unable to start EmbeddedCassandra[name='cassandra-2', version='3.11.6']
...
Caused by: java.io.IOException: 'WindowsCassandraNode[pid='-1', exitValue='0']' is not alive. Please see logs for more details
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file C:\Users\manuc\AppData\Local\Temp\apache-cassandra-3.11.6-5333812070060739596/logs/gc.log due to No such file or directory
...
ava.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind
ERROR [main] 2020-09-17 06:27:11,872 CassandraDaemon.java:774 - Port already in use: 7199; nested exception is:
我可能做错了什么?正如跟踪所说 cassandra-2
,Cassandra 的另一个实例似乎已经 运行ning?难道测试是同时进行的 运行ning 吗? 运行在Intellij/Scalatest
中串行测试的方法是什么?
这个答案提到 Scalatest 会 运行 并行执行,这可能会导致端口冲突问题。有没有办法避免 embedded-cassandra
或 运行 系列中的端口冲突? - How to run tests in a class sequentially in ScalaTest?
您可以尝试使用随机端口来解决您的问题:
EmbeddedCassandraFactory cassandraFactory = new EmbeddedCassandraFactory();
cassandraFactory.setPort(0);
cassandraFactory.setSslPort(0); // if SSL client options enabled
cassandraFactory.setRpcPort(0);
cassandraFactory.setJmxLocalPort(0);
cassandraFactory.setStoragePort(0);
cassandraFactory.setSslStoragePort(0); // // if SSL server options enabled