我正在尝试使用Ubuntu 14.04在单节点虚拟机VM中安装Apache Cassandra 3.11,并遵循此处提供的安装指南find(1)。
我安装了java 8
java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)
然后执行以下步骤来安装Cassandra:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" |sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
echo "deb-src http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | sudo apt-key add -
gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
gpg --export --armor 0353B12C | sudo apt-key add -
sudo apt-get update
sudo apt-get install cassandra
然后我跑了
sudo service cassandra status
* could not access pidfile for Cassandra
所以我改变了
CMD_PATT="cassandra.+CassandraDaemon" to "cassandra"
在
sudo nano +60 /etc/init.d/cassandra
然而,当我再次运行cassandra服务时,它返回了相同的结果。 我试图直接执行cassandra,如下所示:
sudo -su cassandra
我收到了错误:
user@user-VirtualBox:/home$
WARN [main] 2017-06-30 17:52:27,800 DatabaseDescriptor.java:540 - Only
24.622GiB free across all data volumes. Consider adding more capacity to
your cluster or removing obsolete snapshots
INFO [main] 2017-06-30 17:52:27,928 RateBasedBackPressure.java:123 -
Initialized back-pressure with high ratio: 0.9, factor: 5, flow: FAST,
window size: 2000.
INFO [main] 2017-06-30 17:52:27,929 DatabaseDescriptor.java:710 - Back-
pressure is disabled with strategy
org.apache.cassandra.net.RateBasedBackPressure{high_ratio=0.9, factor=5,
flow=FAST}.
INFO [main] 2017-06-30 17:52:28,430 FileUtils.java:78 - Cannot initialize
un-mmaper. (Are you using a non-Oracle JVM?) Compacted data files will not
be removed promptly. Consider using an Oracle JVM or using standard disk
access mode
Exception (java.lang.NoClassDefFoundError) encountered during startup:
com/sun/jmx/remote/internal/RMIExporter
java.lang.NoClassDefFoundError: com/sun/jmx/remote/internal/RMIExporter
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
at
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.java:91)
at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.java:143)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:188)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:600)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:689)
Caused by: java.lang.ClassNotFoundException: com.sun.jmx.remote.internal.RMIExporter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 14 more
ERROR [main] 2017-06-30 17:52:28,536 CassandraDaemon.java:706 - Exception
encountered during startup
java.lang.NoClassDefFoundError: com/sun/jmx/remote/internal/RMIExporter
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007) ~
[na:na]
atjava.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.ja
va:174) ~[na:na]
atjava.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassL
oader.java:801) ~[na:na]
atjava.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNul
l(BuiltinClassLoader.java:699) ~[na:na]
atjava.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinCl
assLoader.java:622) ~[na:na]
atjava.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoa
der.java:580) ~[na:na]
atjava.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassL
oaders.java:185) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]
atorg.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.j
ava:91) ~[apache-cassandra-3.11.0.jar:3.11.0]
atorg.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.
java:143) [apache-cassandra-3.11.0.jar:3.11.0]
atorg.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:18
8) [apache-cassandra-3.11.0.jar:3.11.0]
atorg.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java
:600) [apache-cassandra-3.11.0.jar:3.11.0]
atorg.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:689
) [apache-cassandra-3.11.0.jar:3.11.0]
Caused by: java.lang.ClassNotFoundException:
com.sun.jmx.remote.internal.RMIExporter
atjava.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoa
der.java:582) ~[na:na]
atjava.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassL
oaders.java:185) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]
... 14 common frames omitted
我错过了什么?这是java instalation的错误吗?我应该降低Cassandra版本吗?是VM的东西吗?
谢谢。
答案 0 :(得分:0)
我在Windows上遇到了同样的错误。当时,我的JAVA_HOME设置为JDK 1.9。我改为指向JRE1.8.0_144并且它有效。还确保我安装了Python 2.7(不确定这对你是否重要)。