-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoClassDefFoundError when using service account credentials #1045
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
We have the same problem. |
Same problem. downgrading to 9.4.1 helped |
Could we see your pom.xml/ build.gradle files to help with troubleshooting and narrowing down the issue? Pulling down v9.4.1 of Firebase, I see this from running
My suspicion is that something is overriding these versions. If so, then I think we may need to explicitly declare the auth credentials module. v9.4.2 brings in Auth-Http >= 1.28.0 and that would cause issues with Auth-Credentials < 1.28.0 (which may be explicitly managed/ set by something else). |
|
Thanks for sharing the build files. Could you also run |
Ah, thanks for that. I am able to repro the issue locally. Interestingly, I would have assumed that the Libraries-Bom in the dependencyManagement section of Firebase would have declared the Auth-Credentials dep pulled in by java-client-client to be v1.27.0, but that doesn't seem to be the case as it pulls in v1.23.0. My Maven knowledge is a bit lacking here and I'm not entirely sure why it doesn't. I'm assuming for it to pull down the version, it would require your project to declare Libraries-Bom in your dependencyManagement section. There doesn't seem to be any reason for that given that you don't have any Google Java Client Libraries. Maven's dep resolution strategy ends up using the first declaration of google-auth-credentials from java-api-client as it sees that dep first (this is when transitive dependencies have the same depth). I think I will need to bump the google-auth version in google-api-client and cut a new release for that as part of the Libraries-Bom (~2 weeks). In the meantime, I think the workaround for this is to temporarily declare the Auth-Credential version to be >1.28.0 or downgrade Firebase to v9.4.1. |
I'm using the following code to initialize the firebase admin sdk:
The credentialsStream I'm injecting is read from a service account file.
This code, which worked fine in 9.4.1, now fails in 9.4.2 with the followin error:
java.lang.NoClassDefFoundError: com/google/auth/CredentialTypeForMetrics
As far as I can tell, this issue is caused by a dependency conflict between the following libs:
maven selects google-auth-library-credentials:1.23.0 which causes the ServiceAccountCredentials class to fail to load due to the CredentialTypeForMetrics class only existing since google-auth-library-credentials version 1.28.0.
Adding an explicit dependency to google-auth-library-credentials:1.29.0 in my maven project seems to workaround the issue.
The text was updated successfully, but these errors were encountered: