简体   繁体   English

启动Cassandra 2.0.6时出现UnsupportedClassVersionError

[英]UnsupportedClassVersionError when starting Cassandra 2.0.6

I'm fully aware that this question has already been asked in a way in this thread: 我完全知道,此问题已经在以下线程中以某种方式提出过:

Cassandra:UnsupportedClassVersionError Cassandra:UnsupportedClassVersionError

However, the answer/s given there, which I accept, don't solve my problem as I do have a current version of Java as detailed below: 但是,那里给出的答案(我接受)不能解决我的问题,因为我确实有Java的最新版本,如下所示:

 D:\\Development\\Cassandra\\apache-cassandra-2.0.6>java -version 

java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing) Java版本“ 1.7.0_45” Java™SE运行时环境(内部版本1.7.0_45-b18)Java HotSpot(TM)客户端VM(内部版本24.45-b08,混合模式,共享)

Knowing this, I still receive the error when starting Cassandra: 知道这一点,我在启动Cassandra时仍然收到错误:

D:\\Development\\Cassandra\\apache-cassandra-2.0.6>bin\\cassandra -f Starting Cassandra Server Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/cassandra/service/CassandraDaemon : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) 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 ma D:\\ Development \\ Cassandra \\ apache-cassandra-2.0.6> bin \\ cassandra -f在线程“ main”中启动Cassandra Server异常java.lang.UnsupportedClassVersionError:org / apache / cassandra / service / CassandraDaemon:不受支持的major.minor版本51.0在java.lang.ClassLoader.defineClass1(本机方法)在java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)在java.lang.ClassLoader.defineClass(ClassLoader.java:615)在java.security.SecureClassLoader。在java.net.URLClassLoader.access $ 000(URLClassLoader.java:58)处的java.net.URLClassLoader.defineClass(URLClassLoader.java:283)的defineClass(SecureClassLoader.java:141)在java.net.URLClassLoader $ 1.run(URLClassLoader) .java:197),位于java.net.URLClassLoader.findClass(URLClassLoader.java:190),位于java.security.AccessController.doPrivileged(本机方法),位于java.lang.ClassLoader.loadClass(ClassLoader.java:306)。在java.lang.ClassLoader.loadClass(ClassLoader.java:247)上的misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)找不到MA in class: org.apache.cassandra.service.CassandraDaemon. 在课程中:org.apache.cassandra.service.CassandraDaemon。 Program will exit. 程序将会退出。

I'm running on a Windows XP machine using the command prompt (not Cygwin) to start Cassandra and I'm able to start older versions of Cassandra without any issue (apache-cassandra-1.1.4). 我正在Windows XP计算机上运行,​​使用命令提示符(不是Cygwin)启动Cassandra,并且能够启动旧版本的Cassandra,而没有任何问题(apache-cassandra-1.1.4)。 Am I doing something incorrect with the later version of Cassandra or have I missed something somewhere in my configuration that is blindingly obvious? 我是在使用更高版本的Cassandra做不正确的事情,还是在配置中错过了显而易见的地方?

The only plausible explanation for that exception is that a Java 6 (or earlier) JVM is being use to run code that was compiled for the Java 7 target platform. 对该异常的唯一合理解释是,正在使用Java 6(或更早版本)的JVM来运行针对Java 7目标平台编译的代码。

This contradicts what you believe to be happening. 这与您认为正在发生的事情相矛盾。 Nevertheless, it is the only plausible explanation. 然而,这是唯一合理的解释。

I suggest that you make a copy of the cassandra wrapper script (in the same directory), and hack it to: 我建议您复制cassandra包装器脚本的副本(在同一目录中),然后将其砍到:

  1. add set -x at the start to see what commands are actually being run by the script. 在开始处添加set -x ,以查看脚本实际上正在运行哪些命令。

  2. add echo $PATH , echo $JAVA_HOME and so on to see what the key environment variables are in the script's environment. 添加echo $PATHecho $JAVA_HOME等,以查看脚本环境中的关键环境变量是什么。

  3. add a line to run java -version using the exact same command path that is being use to run the JVM for real. 使用与实际运行JVM完全相同的命令路径添加一行以运行java -version

This should reveal which of your beliefs / assumptions about what is happening are incorrect. 这应该表明您对正在发生的事情的信念/假设中哪些是不正确的。

我确实尝试了卸载Java 1.7并安装了最新的Java 8,从而解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM