Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
at merchandising_cpm.j_etl10029d_cpm_t3464_spn_itm_extract_db2_stg_0_1.J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.tDBInput_1Process(J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.java:3011)
at merchandising_cpm.j_etl10029d_cpm_t3464_spn_itm_extract_db2_stg_0_1.J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.runJobInTOS(J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.java:5586)
at merchandising_cpm.j_etl10029d_cpm_t3464_spn_itm_extract_db2_stg_0_1.J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.main(J_ETL10029D_CPM_T3464_Spn_Itm_Extract_DB2_Stg.java:5306)
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.AsyncFunction
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 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();