Hi Tomo,

I put a breakpoint and try tracing through it. I do not find any static
initialization problems. com.google.cloud.bigquery.storage.v1beta1.Storage
is an auto generated protobuf class.
In fact, seems like when the code tries to access protobuf class in package
"com.google.cloud.bigquery.storage.v1beta1" it will throw NoClassDefFound
exception. For example, I
also get NoClassDefFoundError for
com.google.cloud.bigquery.storage.v1beta1.TableReferenceProto class.

Thanks!

On Thu, Mar 12, 2020 at 6:20 PM Tomo Suzuki <suzt...@google.com> wrote:

> I tried looking at the dependency tree but couldn't identify any
> discrepancy in versions. In general, NoClassDefFoundError occurs when a
> class is missing as well as static initializers fails. From the error, I
> feel that's the latter in this case.
> Is it possible to set a breakpoint at
> com.google.cloud.bigquery.storage.v1beta1.Storage line 5216 and see any
> failure in static fields of the Storage class?
>
>
>
> On Thu, Mar 12, 2020 at 5:50 PM Zhiheng Huang <sylvon.w...@gmail.com>
> wrote:
>
>> Hi Tomo,
>>
>> Thanks for looking. Not the actual build.gradle, but this build.gradle
>> <https://gist.github.com/sylvon/908bd08424cfbcc91f1819ab5325d6fa> shows
>> the google/beam related dependencies I used.
>>
>> Thanks!
>>
>> On Thu, Mar 12, 2020 at 7:49 AM Tomo Suzuki <suzt...@google.com> wrote:
>>
>>> Hi Zhiheng,
>>> Would you share your pom.xml or build.gradle? I'd like to know the
>>> dependencies of your project.
>>>
>>> On Thu, Mar 12, 2020 at 12:37 AM Zhiheng Huang <sylvon.w...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to use big query storage API on google dataflow, but I keep
>>>> getting:
>>>>
>>>> java.lang.NoClassDefFoundError: Could not initialize class
>>>> com.google.cloud.bigquery.storage.v1beta1.Storage
>>>> at
>>>> com.google.cloud.bigquery.storage.v1beta1.Storage$CreateReadSessionRequest.internalGetFieldAccessorTable(Storage.java:5216)
>>>> at
>>>> com.google.protobuf.GeneratedMessageV3.getAllFieldsMutable(GeneratedMessageV3.java:135)
>>>> at
>>>> com.google.protobuf.GeneratedMessageV3.getAllFields(GeneratedMessageV3.java:211)
>>>> at com.google.protobuf.TextFormat$Printer.print(TextFormat.java:324)
>>>> at
>>>> com.google.protobuf.TextFormat$Printer.access$000(TextFormat.java:307)
>>>> at com.google.protobuf.TextFormat.print(TextFormat.java:68)
>>>> at com.google.protobuf.TextFormat.printToString(TextFormat.java:148)
>>>> at
>>>> com.google.protobuf.AbstractMessage.toString(AbstractMessage.java:117)
>>>> at
>>>> org.slf4j.helpers.MessageFormatter.safeObjectAppend(MessageFormatter.java:299)
>>>> at
>>>> org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:271)
>>>> at
>>>> org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:233)
>>>> at
>>>> org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:173)
>>>> at org.slf4j.helpers.MessageFormatter.format(MessageFormatter.java:151)
>>>> at org.slf4j.impl.SimpleLogger.formatAndLog(SimpleLogger.java:354)
>>>> at org.slf4j.impl.SimpleLogger.info(SimpleLogger.java:496)
>>>> at
>>>> org.apache.beam.sdk.io.gcp.bigquery.BigQueryStorageSourceBase.split(BigQueryStorageSourceBase.java:140)
>>>> at
>>>> org.apache.beam.sdk.io.gcp.bigquery.BigQueryStorageTableSource.split(BigQueryStorageTableSource.java:42)
>>>> ...
>>>>
>>>>
>>>> This seems like a library dependency problem. Anyone can point me to
>>>> the correct library dependency for using the API or know what might be
>>>> wrong here? I am using beam 2.19 and already included
>>>> "com.google.api.grpc:proto-google-cloud-bigquerystorage-v1beta1:0.83.0" and
>>>> "com.google.cloud:google-cloud-bigquerystorage:0.79.0-alpha" in my gradle
>>>> dependency.
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>
>>>
>>> --
>>> Regards,
>>> Tomo
>>>
>>
>>
>> --
>> Sylvon Huang
>>
>
>
> --
> Regards,
> Tomo
>


-- 
Sylvon Huang

Reply via email to