Created
January 19, 2014 18:23
-
-
Save zmarcantel/8508830 to your computer and use it in GitHub Desktop.
DataStax Java driver issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// My class constructor | |
// | |
public CassandraDataModel() { | |
this.cluster = Cluster.builder() | |
.addContactPoint("127.0.0.1") | |
// .withSSL() // Uncomment if using client to node encryption | |
.build(); | |
Metadata metadata = this.cluster.getMetadata(); | |
System.out.printf("Connected to cluster: %s\n", | |
metadata.getClusterName()); | |
for ( Host host : metadata.getAllHosts() ) { | |
System.out.printf("Datacenter: %s; Host: %s; Rack: %s\n", | |
host.getDatacenter(), host.getAddress(), host.getRack()); | |
} | |
session = cluster.connect(); | |
} | |
// | |
// Output of mvn test or manual running | |
// | |
testConnection(com.canwe.InterestRecommenderTest) Time elapsed: 0.005 sec <<< ERROR! | |
java.lang.NoClassDefFoundError: com/google/common/util/concurrent/FutureCallback | |
at com.datastax.driver.core.Cluster.<init>(Cluster.java:76) | |
at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:132) | |
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:771) | |
at com.canwe.CassandraDataModel.<init>(CassandraDataModel.java:28) | |
at com.canwe.InterestRecommenderTest.<init>(InterestRecommenderTest.java:13) | |
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) | |
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) | |
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) | |
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) | |
at org.junit.internal.runners.JUnit4ClassRunner.createTest(JUnit4ClassRunner.java:72) | |
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:79) | |
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) | |
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) | |
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) | |
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) | |
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) | |
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) | |
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) | |
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | |
at java.lang.reflect.Method.invoke(Method.java:597) | |
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) | |
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) | |
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) | |
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) | |
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) | |
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.FutureCallback | |
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) | |
... 28 more |
I have the same problem, please help me! the code is http://pastebin.com/whXdPRS7
I have the same problem
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How have u solved this?
I ran into the same issue and I was using Hector Maven dependency and Datastax Maven dependency together. I fixed the issue by placing the hector dependency after the datastax dependency.