0

I am new to cassandra and I am trying to make an installation of cassandra 1.1.9 with JAVA oracle 7 but I am getting the following error:

cassandra -f
    xss =  -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1862M -Xmx1862M -Xmn200M -XX:+HeapDumpOnOutOfMemoryError -Xss256k
    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)

For what I read in How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version its an incompatibility between the source and the Java version but to me it seems to be okey:

ubuntu@localhost:~$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) 

Anyone knows what I might be missing?

Community
  • 1
  • 1
bonzofenix
  • 635
  • 5
  • 12
  • 1
    You are probably using a different java binary in Cassandra. Which binary is found by your cassandra script? Do you have JAVA_HOME set? – Richard Dec 20 '13 at 16:41
  • actually you are right my JAVA_HOME is pointing to another version : $ echo $JAVA_HOME `/opt/java/64/jdk1.6.0_38` and $which java `/usr/bin/java` . Cassandra user JAVA_HOME to find the binary? – bonzofenix Dec 20 '13 at 17:07

1 Answers1

2

at the beginning of shell script that start cassandra add

export JAVA_HOME=/path/to/java_v7
export PATH=$JAVA_HOME/bin:$PATH

and it should help

JosefN
  • 952
  • 6
  • 8
  • So it seems i had JAVA_HOME set on /home/ubuntu/.profile so I created a /home/ubuntu/.bash_profile with this lines and worked for me.Thanks! – bonzofenix Dec 30 '13 at 17:00