Cassandra源代码配置Exception Idection uri in cassandra.config找到了C



对于我的主论文,我必须修改卡桑德拉的源代码。因此,正如https://wiki.apache.org/cassandra/howtobuild所建议的那样,我git clone,然后运行蚂蚁,一切似乎都不错(我设法构建了该项目而没有任何错误),但是当我运行UnitTests时(卡桑德拉/测试),我有一个奇怪的错误:

org.apache.cassandra.exceptions.ConfigurationException: 
   Expecting URI in variable: [cassandra.config]. 
   Found[cassandra.yaml]. 
   Please prefix the file with [file:\] for local files and 
      [file:\<server>] for remote files. 
   If you are executing this from an external tool, it needs 
   to set Config.setClientMode(true) to avoid loading configuration.
at org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:80)
    at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:100)
    at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:252)
    at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:131)
    at org.apache.cassandra.auth.jmx.AuthorizationProxyTest.setup(AuthorizationProxyTest.java:48)"

我想使用Unitests对源代码上的修改进行测试(因为我没有找到如何从Windows上的源代码设置Cassandra的任何教程,因此,如果您有一个,我想拥有链接^^),但我没有设法找到此错误的任何解决方案:(。任何人都知道解决此问题的解决方案吗?

我正在使用Intellij在Windows 10上工作,并且将JDK和ANT更新为最新版本。

我正面临同一问题。这些变量(" Cassandra.config"," Cassandra.storagedir"等...) System变量

您可以通过执行以下操作来将它们设置在代码中:

System.setProperty("cassandra.config", "file:///<PATH>/cassandra.yaml");

您还可以在运行JAR文件时将它们设置:

java -Dcassandra.config=file:///<PATH>/cassandra.yaml -jar <JAR>

最好,

Shabir

在JDK 1.8中启动一个新过程,然后在其中启动嵌入式cassandra。并在Java版本中运行Junit。我遇到了类似的ISUE JDK11升级。现在我修复了这个。

import org.cassandraunit.utils.EmbeddedCassandraServerHelper;

导入org.springframework.boot.autoconfigure.springbootapplication;

@SpringBootApplication
public class EmbeddedCassandraApplication {
    public static void main(String[] args) throws Exception {
        EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra-test.yaml");
    }
}

最新更新