Skip to content
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

Seeing java.lang.NoSuchMethodError while initiliazing AwsCredentialsProviderChain #4778

Closed
mukund-thakur opened this issue Dec 13, 2023 · 13 comments
Labels
bug This issue is a bug. closing-soon This issue will close in 4 days unless further comments are made. p2 This is a standard priority issue

Comments

@mukund-thakur
Copy link

Describe the bug

Full stack trace.
Caused by: java.lang.NoSuchMethodError: software.amazon.awssdk.thirdparty.org.slf4j.impl.StaticLoggerBinder.getLoggerFactoryClassStr()Ljava/lang/String; at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.reportActualBinding(LoggerFactory.java:349) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.bind(LoggerFactory.java:152) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.thirdparty.org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.utils.Logger.loggerFor(Logger.java:221) ~[bundle-2.21.41.jar:?] at software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain.<clinit>(AwsCredentialsProviderChain.java:56) ~[bundle-2.21.41.jar:?]

Expected Behavior

Expected it to work.

Current Behavior

Not working. Getting above error.

Reproduction Steps

Unable to reproduce this locally. This is not working in one of our newly created clusters.

Possible Solution

https://github.com/aws/aws-sdk-java-v2/blob/2.21.41/bundle-logging-bridge/src/main[…]amazon/awssdk/thirdparty/org/slf4j/impl/StaticLoggerBinder.java We have this newly added class which doesn't contain this method
but it is present in the actual slf4j implementation.
https://github.com/qos-ch/slf4j/blob/v_1.7.30/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java

Additional Information/Context

No response

AWS Java SDK version used

2.21.41

JDK version used

OpenJDK Runtime Environment (build 1.8.0_392-b08)

Operating System and version

EC2 linux VM

@mukund-thakur mukund-thakur added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 13, 2023
@debora-ito debora-ito removed the needs-triage This issue or PR still needs to be triaged. label Dec 13, 2023
@debora-ito
Copy link
Member

A fix is in the works, see #4777.

@debora-ito debora-ito added the p2 This is a standard priority issue label Dec 13, 2023
@shwethags
Copy link

@debora-ito when will the sdk release with this fix be available?

@mukund-thakur
Copy link
Author

@debora-ito I see the fix has been merged in master but it I guess it will be released tomorrow. How can we create the big bundle jar locally such that we can test if the fix works for us? can you please share the maven command?

@debora-ito
Copy link
Member

Sorry I missed the questions here.

The fix in #4777 was released in version 2.21.46.

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@mukund-thakur
Copy link
Author

Thanks @debora-ito . Yes, we have upgraded to 2.21.46.
One of our servers is failing after the upgrade from 2.21.40 with below error

java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/eclipse/jetty/start/Classpath$Loader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:423) ~[bundle-2.21.46.jar:?]
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362) ~[bundle-2.21.46.jar:?]
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388) ~[bundle-2.21.46.jar:?]

As per our debugging, we have identified that
Version 2.21.41 (and newer versions) contains unshaded slf4j, unlike the earlier versions.

In 2.21.40 we only have software/amazon/awssdk/thirdparty


$ unzip -l /tmp/bundle-2.21.40.jar | grep 'slf4j'
        0  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/
        0  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/
      623  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/EventConstants.class
    10998  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/EventRecodingLogger.class
     1654  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/Level.class
      534  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/LoggingEvent.class
     3023  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/event/SubstituteLoggingEvent.class
        0  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/
     3591  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/BasicMarker.class
     1906  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/BasicMarkerFactory.class
     1403  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/BasicMDCAdapter$1.class
     2788  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/BasicMDCAdapter.class
     1159  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/FormattingTuple.class
     5147  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/MarkerIgnoringBase.class
     7825  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/MessageFormatter.class
      993  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/NamedLoggerBase.class
     3369  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/NOPLogger.class
      788  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/NOPLoggerFactory.class
     1351  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/NOPMDCAdapter.class
    11044  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/SubstituteLogger.class
     2539  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/SubstituteLoggerFactory.class
      264  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/Util$1.class
      969  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/Util$ClassContextSecurityManager.class
     3190  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/helpers/Util.class
      248  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/ILoggerFactory.class
      340  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/IMarkerFactory.class
     1613  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/Logger.class
    13629  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/LoggerFactory.class
      802  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/Marker.class
     1995  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/MarkerFactory.class
      245  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/MDC$1.class
      953  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/MDC$MDCCloseable.class
     4151  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/MDC.class
        0  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/spi/
      557  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/spi/LocationAwareLogger.class
      317  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/spi/LoggerFactoryBinder.class
      317  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/spi/MarkerFactoryBinder.class
      563  12-16-2019 22:03   software/amazon/awssdk/thirdparty/org/slf4j/spi/MDCAdapter.class
        0  12-16-2019 21:59   META-INF/maven/org.slf4j/
        0  12-16-2019 21:59   META-INF/maven/org.slf4j/slf4j-api/
     3835  12-16-2019 21:59   META-INF/maven/org.slf4j/slf4j-api/pom.xml
      109  12-16-2019 22:00   META-INF/maven/org.slf4j/slf4j-api/pom.properties 

but 2.21.46 also have unshaded org/slf4j:


unzip -l bundle-2.21.46.jar | grep ' org/slf4j'
        0  12-16-2019 22:03   org/slf4j/
        0  12-16-2019 22:03   org/slf4j/event/
      594  12-16-2019 22:03   org/slf4j/event/EventConstants.class
     9842  12-16-2019 22:03   org/slf4j/event/EventRecodingLogger.class
     1489  12-16-2019 22:03   org/slf4j/event/Level.class
      432  12-16-2019 22:03   org/slf4j/event/LoggingEvent.class
     2615  12-16-2019 22:03   org/slf4j/event/SubstituteLoggingEvent.class
        0  12-16-2019 22:03   org/slf4j/helpers/
     3285  12-16-2019 22:03   org/slf4j/helpers/BasicMarker.class
     1634  12-16-2019 22:03   org/slf4j/helpers/BasicMarkerFactory.class
     1233  12-16-2019 22:03   org/slf4j/helpers/BasicMDCAdapter$1.class
     2618  12-16-2019 22:03   org/slf4j/helpers/BasicMDCAdapter.class
     1091  12-16-2019 22:03   org/slf4j/helpers/FormattingTuple.class
     4773  12-16-2019 22:03   org/slf4j/helpers/MarkerIgnoringBase.class
     7553  12-16-2019 22:03   org/slf4j/helpers/MessageFormatter.class
      823  12-16-2019 22:03   org/slf4j/helpers/NamedLoggerBase.class
     3267  12-16-2019 22:03   org/slf4j/helpers/NOPLogger.class
      584  12-16-2019 22:03   org/slf4j/helpers/NOPLoggerFactory.class
     1249  12-16-2019 22:03   org/slf4j/helpers/NOPMDCAdapter.class
    10262  12-16-2019 22:03   org/slf4j/helpers/SubstituteLogger.class
     2199  12-16-2019 22:03   org/slf4j/helpers/SubstituteLoggerFactory.class
      196  12-16-2019 22:03   org/slf4j/helpers/Util$1.class
      765  12-16-2019 22:03   org/slf4j/helpers/Util$ClassContextSecurityManager.class
     2952  12-16-2019 22:03   org/slf4j/helpers/Util.class
      180  12-16-2019 22:03   org/slf4j/ILoggerFactory.class
      272  12-16-2019 22:03   org/slf4j/IMarkerFactory.class
     1375  12-16-2019 22:03   org/slf4j/Logger.class
    12547  12-16-2019 22:03   org/slf4j/LoggerFactory.class
      666  12-16-2019 22:03   org/slf4j/Marker.class
     1621  12-16-2019 22:03   org/slf4j/MarkerFactory.class
      177  12-16-2019 22:03   org/slf4j/MDC$1.class
      749  12-16-2019 22:03   org/slf4j/MDC$MDCCloseable.class
     3675  12-16-2019 22:03   org/slf4j/MDC.class
        0  12-16-2019 22:03   org/slf4j/spi/
      455  12-16-2019 22:03   org/slf4j/spi/LocationAwareLogger.class
      249  12-16-2019 22:03   org/slf4j/spi/LoggerFactoryBinder.class
      249  12-16-2019 22:03   org/slf4j/spi/MarkerFactoryBinder.class
      529  12-16-2019 22:03   org/slf4j/spi/MDCAdapter.class

Do you think anything has changed after 2.20.40 which could cause this? Thanks
CC @dagnir

@dagnir
Copy link
Contributor

dagnir commented Dec 20, 2023

Working on fixing this, you're right that those unshaded classes should not be present in the JAR.

@dagnir dagnir reopened this Dec 20, 2023
@shwethags
Copy link

Will you be able to give a release with this fix today?

@dagnir
Copy link
Contributor

dagnir commented Dec 21, 2023

@shwethags Our release has already finished for today unfortunately. You can track the change in #4797.

@debora-ito
Copy link
Member

The fix #4797 was released as part of version 2.22.4.

Will keep this issue open a little longer, let us know if there's any other issue with the bundle jar.

@debora-ito debora-ito added the closing-soon This issue will close in 4 days unless further comments are made. label Dec 22, 2023
@mukund-thakur
Copy link
Author

Thanks. Just tested and it works. We are still facing below issues :
#4779
#4799

@debora-ito
Copy link
Member

Great. We'll post updates in the other issues.

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closing-soon This issue will close in 4 days unless further comments are made. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

4 participants