'java.lang.NoClassDefFoundError: io/opencensus/trace/propagation/TextFormat$Setter' exception using Simba driver in tJDBConnection to connect BigQuery on GCP

Problem Description

Using the Simba driver in the tJDBConnection component to connect to the BigQuery database on GCP, throws the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: io/opencensus/trace/propagation/TextFormat$Setter
    at com.google.api.client.http.HttpRequest.<init>(HttpRequest.java:225)
    at com.google.api.client.http.HttpTransport.buildRequest(HttpTransport.java:123)
    at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:91)
    at com.google.api.client.http.HttpRequestFactory.buildPostRequest(HttpRequestFactory.java:133)
    at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:279)
    at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:158)
    at com.simba.googlebigquery.googlebigquery.client.BQClient.userAccountOAuth(Unknown Source)
    at com.simba.googlebigquery.googlebigquery.core.BQConnection.connect(Unknown Source)
    at com.simba.googlebigquery.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
    at com.simba.googlebigquery.jdbc.common.AbstractDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at org.talend.components.jdbc.runtime.JdbcRuntimeUtils.createConnection(JdbcRuntimeUtils.java:64)
    at org.talend.components.jdbc.runtime.JdbcRuntimeUtils.createConnectionOrGetFromSharedConnectionPoolOrDataSource(JdbcRuntimeUtils.java:193)
    at org.talend.components.jdbc.runtime.JDBCSourceOrSink.connect(JDBCSourceOrSink.java:217)
    at org.talend.components.jdbc.runtime.setting.JdbcRuntimeSourceOrSinkDefault.initConnection(JdbcRuntimeSourceOrSinkDefault.java:46)
    at org.talend.components.jdbc.runtime.JdbcRuntimeUtils.validate(JdbcRuntimeUtils.java:88)
    at org.talend.components.jdbc.runtime.JDBCSourceOrSink.validate(JDBCSourceOrSink.java:121)
    at digital_analytics.test_bigquery_0_1.test_bigquery.tDBConnection_1Process(test_bigquery.java:1585)
    at digital_analytics.test_bigquery_0_1.test_bigquery.tLibraryLoad_6Process(test_bigquery.java:1394)
    at digital_analytics.test_bigquery_0_1.test_bigquery.runJobInTOS(test_bigquery.java:3588)
    at digital_analytics.test_bigquery_0_1.test_bigquery.main(test_bigquery.java:3402)
Caused by: java.lang.ClassNotFoundException: io.opencensus.trace.propagation.TextFormat$Setter
    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)

 

Root Cause

The Job is missing the TextFormat class that has the inner Setter class.

 

Solution

The TextFormat$Setter class is located in the opencensus-api-0.19.0.jar file. However, to use this file in the Job, you'll also need to add the opencensus-contrib-http-util-0.19.0.jar and grpc-context-1.18.0.jar files to the Job. Using a tLibraryLoad component, add these files to the Job, as shown below:

t1.png

 

Warnings

Using the Simba driver version 42 (GoogleBigQueryJDBC42.jar) requires the following JAR file versions:

  • jackson-core-2.9.8.jar
  • google-oauth-client-1.28.0.jar
  • google-http-client-jackson2-1.28.0.jar
  • google-http-client-1.28.0.jar
  • grpc-context-1.18.0.jar
  • google-api-client-1.28.0.jar
  • google-api-services-bigquery-v2-rev410-1.25.0.jar

The GoogleBigQueryJDBC42.jar file does not work with older JAR versions, such as google-api-client-1.22.0.jar, google-api-services-bigquery-v2-rev399-1.22.0.jar, google-http-client-1.22.0.jar, google-http-client-jackson2-1.22.0.jar, google-oauth-client-1.22.0.jar, and jackson-databind-2.1.2.jar.

Version history
Revision #:
2 of 2
Last update:
‎05-02-2019 08:49 AM
Updated by:
 
Contributors