Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

remove direct dependency on Jackson#1267

Merged
elharo merged 20 commits intomasterfrom
jackson
Jan 27, 2021
Merged

remove direct dependency on Jackson#1267
elharo merged 20 commits intomasterfrom
jackson

Conversation

@elharo
Copy link
Copy Markdown
Contributor

@elharo elharo commented Jan 14, 2021

@elharo elharo requested review from a team and vam-google January 14, 2021 16:20
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jan 14, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 14, 2021

Codecov Report

Merging #1267 (78ed612) into master (96b92db) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1267      +/-   ##
============================================
- Coverage     79.23%   79.19%   -0.04%     
+ Complexity     1236     1235       -1     
============================================
  Files           209      209              
  Lines          5378     5378              
  Branches        454      454              
============================================
- Hits           4261     4259       -2     
- Misses          938      939       +1     
- Partials        179      180       +1     
Impacted Files Coverage Δ Complexity Δ
...oogle/api/gax/httpjson/ManagedHttpJsonChannel.java 54.00% <100.00%> (ø) 5.00 <1.00> (ø)
.../java/com/google/api/gax/batching/BatcherImpl.java 96.77% <0.00%> (-1.30%) 16.00% <0.00%> (-1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96b92db...78ed612. Read the comment docs.

@elharo
Copy link
Copy Markdown
Contributor Author

elharo commented Jan 14, 2021

Not sure why this only happens in bazel but it looks like the auth client might not declare its dependencies properly:

Time: 0.124
There was 1 failure:
1) testBasic(com.google.api.gax.rpc.FixedTransportChannelProviderTest)
java.lang.NoClassDefFoundError: com/google/api/client/json/jackson2/JacksonFactory
	at com.google.auth.oauth2.ComputeEngineCredentials.<init>(ComputeEngineCredentials.java:107)
	at com.google.auth.oauth2.ComputeEngineCredentials.create(ComputeEngineCredentials.java:120)
	at com.google.api.gax.rpc.FixedTransportChannelProviderTest.testBasic(FixedTransportChannelProviderTest.java:85)
	... 25 trimmed
Caused by: java.lang.ClassNotFoundException: com.google.api.client.json.jackson2.JacksonFactory
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	... 29 more

@elharo
Copy link
Copy Markdown
Contributor Author

elharo commented Jan 15, 2021

Not sure what ComputeEngineCredentials is doing wrong exactly, but google-auth-library 023.0 should fix this

@elharo
Copy link
Copy Markdown
Contributor Author

elharo commented Jan 26, 2021

Tentatively I think what's happening here is that google-auth-library:0.22.2 doesn't properly declare its dependency on jackson and bazel is pickier about that than gradle is.

This should resolve when google-auth-library:0.23.0 is released which removes the Jackson dependency.

@elharo
Copy link
Copy Markdown
Contributor Author

elharo commented Jan 27, 2021

java.lang.NoClassDefFoundError: com/google/gson/stream/JsonReader
	at com.google.api.client.json.gson.GsonFactory.createJsonParser(GsonFactory.java:81)
	at com.google.api.client.json.gson.GsonFactory.createJsonParser(GsonFactory.java:71)
	at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:77)
	at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:73)
	at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:157)
	at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:134)
	at com.google.api.gax.rpc.ClientSettingsTest.loadCredentials(ClientSettingsTest.java:308)
	at com.google.api.gax.rpc.ClientSettingsTest.<clinit>(ClientSettingsTest.java:107)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at com.google.testing.junit.runner.PersistentTestRunner.getTestClass(PersistentTestRunner.java:206)
	at com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:142)
	at com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:85)
Caused by: java.lang.ClassNotFoundException: com.google.gson.stream.JsonReader
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 13 more

@elharo
Copy link
Copy Markdown
Contributor Author

elharo commented Jan 27, 2021

bazel isn't as smart as Maven and Gradle:

"Bazel only reads dependencies listed in your WORKSPACE file. If your project (A) depends on another project (B) which lists a dependency on a third project (C) in its WORKSPACE file, you’ll have to add both B and C to your project’s WORKSPACE file. This requirement can balloon the WORKSPACE file size, but limits the chances of having one library include C at version 1.0 and another include C at 2.0."

@elharo elharo merged commit d01f016 into master Jan 27, 2021
@elharo elharo deleted the jackson branch January 27, 2021 00:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants