I am trying to generate a timeuuid (i.e., version 1 UUID) in Talend to use when loading data into Cassandra.
I would like to do something similar to the java.util.UUID.randomUUID() function that generates a version 4 UUID, except that I need to generate a version 1 UUID. I don't want to have to create a connection to a Cassandra instance and use "select now()" everytime I need to generate a new timeuuid.
I understand that the Datastax Cassandra Java driver includes a "UUIDs" class that can be used to do this, but I can't seem to get the driver installed properly into Talend. I have tried using the tLoadLibrary component with no luck. I have also tried adding the library files to the my custom routine. And I've tried adding the external jars through the preferences.
I am at the point where I'm no longer getting compile errors, but I'm still getting a run time error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/datastax/driver/core/utils/UUIDs ... Caused by: java.lang.ClassNotFoundException: com.datastax.driver.core.utils.UUIDs ...
Below is the code I'm using to make the function call:
String tb = com.datastax.driver.core.utils.UUIDs.timeBased().toString(); System.out.println(tb);
If anyone has had success with getting the Datastax Cassandra Java driver properly installed into Talend (or another simple way of generating a timeuuid) and can help, then that would be great.
I am using Talend Open Studio for Big Data v6.3.
I am developing on a machine with Windows 10.
Jobs are deployed on a Linux server.
I originally tried it with the cassandra-driver-core-3.3.0.jar file, but I also just tried it with the one you supplied (3.3.2) and I'm still getting the same error. Can you walk me through what you did to install the jar file and make the function call?
Strange. That is the same thing I'm doing, but I still get a class not found exception.
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at com.datastax.driver.core.utils.UUIDs.<clinit>(UUIDs.java:66) ... Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more
Watch the recorded webinar!
Introduction to Talend Open Studio for Data Integration.
Test drive Talend's enterprise products.
Practical steps to developing your data integration strategy.