I am getting this error when i am starting cassandra server

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-05 10:26:32

问题


[root@SudeepMangu bin]# ./cassandra -f

xss = -ea -javaagent:/home/sudeep/apache-cassandra-1.2.5-src/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms930M -Xmx930M -Xmn200M -XX:+HeapDumpOnOutOfMemoryError -Xss160k

Exception in thread "main" java.lang.NoClassDefFoundError: *org/apache/cassandra/service/CassandraDaemon* Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.service.CassandraDaemon at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: org.apache.cassandra.service.CassandraDaemon. Program will exit.


回答1:


I'm betting you are starting the server under windows.

Exception in thread "main" java.lang.NoClassDefFoundError

You are getting this exception because you haven't set the CASSANDRA_HOME variable, so when you start the server you are trying to find the path to Cassandra but you cant, because that path is constructed using that environment variable.

Simply add the system variable:

setx CASSANDRA_HOME "C:\path\to\cassandra\"    // Windows
export CASSANDRA_HOME=/path/to/cassandra/      // Unix 

Just a heads up doing this in the cmd will require you to open a new prompt.You can also do it using the GUI approach in Windows.




回答2:


If you do not have an administrative privileges then you might want to add it to the cassandra.bat file as

set CASSANDRA_HOME="C:\Program Files\apache-cassandra-1.2.8"


来源:https://stackoverflow.com/questions/16851308/i-am-getting-this-error-when-i-am-starting-cassandra-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!