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
I am having similar issue.
Downloaded the Cassandra Driver jar and calling using t library component and used below in tjava row:
row2.adddate = com.datastax.driver.core.utils.UUIDs.timeBased().toString();
Getting Below Error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/util/concurrent/AsyncFunction
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.AsyncFunction
... 3 more
Solution provided above worked, when i used the same in Java row component.
row3.adddate = com.datastax.driver.core.utils.UUIDs.timeBased().toString();
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Read about OTTO's experiences with Big Data and Personalized Experiences
Pick up some tips and tricks with Context Variables
Take a look at this video about Talend Integration with Databricks