0

the existing stackoverflow questions on this topic all indicate I have a classpath issue. However, it looks to be correct. Any help greatly appreciated. TIA.

~$ echo $JAVA_HOME; echo $PATH 
/usr/local/jdk1.7.0_71
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk1.7.0_71/bin
~$



~$ ll /usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar
-rw-r--r-- 1 root root 990392 May  2 21:36 /usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar
~$ 



~$ java -classpath ./:/usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar -jar CassandraFunctionalTests.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/datastax/driver/core/Cluster
    at com.seagate.bdcauto.cassandratests.CassandraLabConnector.<init>(CassandraLabConnector.java:13)
    at com.seagate.bdcauto.cassandratests.FunctionalTests.main(FunctionalTests.java:7)
Caused by: java.lang.ClassNotFoundException: com.datastax.driver.core.Cluster
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 2 more
~$ 
Rob Mitchell
  • 1
  • 1
  • 1
  • The Cluster class is in the cassandra-driver-core-3.0.0.jar – Rob Mitchell May 04 '16 at 01:34
  • Add the mentioned jar to classpath and Show your classpath – Rao May 04 '16 at 01:34
  • @Rao ~$ java -classpath ./:/usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar -jar CassandraFunctionalTests.jar – Rob Mitchell May 04 '16 at 01:36
  • Can you try this? `java -classpath .:/usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar:$CLASSPATH -jar CassandraFunctionalTests.jar` – Rao May 04 '16 at 01:37
  • @Rao ~$ java -classpath .:/usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar:$CLASSPATH -jar CassandraFunctionalTests.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/datastax/driver/core/Cluster at com.... – Rob Mitchell May 04 '16 at 01:39
  • Can you check `jar -tvf /usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar | grep Cluster` and see if that shows up. Are you confident that it is the jar? And this time exception is changed, right? May be you need to visit your classes to see why `NoClassDefFoundError` coming. – Rao May 04 '16 at 01:40
  • Yep: ~$ jar tvf /usr/local/cassandra-java-driver-3.0.0/lib/cassandra-driver-core-3.0.0.jar | grep Cluster.class 12059 Thu Jan 28 16:08:24 CST 2016 com/datastax/driver/core/Cluster.class 3077 Thu Jan 28 16:08:26 CST 2016 com/datastax/driver/core/DelegatingCluster.class ~$ – Rob Mitchell May 04 '16 at 01:42
  • See [this](http://stackoverflow.com/questions/28322833/classnotfoundexception-vs-noclassdeffounderror) or [this](http://javarevisited.blogspot.in/2011/07/classnotfoundexception-vs.html) to understand the issue. – Rao May 04 '16 at 01:44
  • May be you want to show the code around `CassandraLabConnector.java:13` – Rao May 04 '16 at 01:49
  • cluster = Cluster.builder().addContactPoints("11.49.5.43 11.49.5.47 11.49.5.53") .withCredentials("USERNAME","PASSWORD") .withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.QUORUM)) .build(); – Rob Mitchell May 04 '16 at 01:59

0 Answers0