-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Base64 static initialization fails when jaxb-core not in classpath with jaxb-impl >= 2.2.11 #1863
Comments
Not having certain classes on the classpath results in a NoClassDefFoundError (that wraps a ClassNotFoundException) which causes static initialization failure. Protect against that by catching Throwable instead of Exception.
Isn't |
As of jaxb-impl >= 2.2.11, yes. It looks like the intention of the static block in Base64 is to use jaxb if possible, but fall back to the SDK impl if it's not available. Not catching the NoClassDefFoundError makes that second bit break - the expected behaviour in that case is to bail out and use the SDK impl. With jaxb-impl < 2.2.11, we don't get the NoClassDefFoundError since only jaxb-impl is needed and not jaxb-core. You're right that we should be including the jaxb-core jar ourselves, but Base64 probably shouldn't fail to initialize without that jar. |
Got it. Catching |
Thanks! I opened #1864 to make that change - might be simpler to hit merge on that guy? |
Fixed in v1.11.485. Thanks for reporting the issue and PR. |
…sDefFoundError: javax/xml/bind/JAXBException” aws/aws-sdk-java#1863
Atualizando pra essa versão resolveu pra mim tambem |
#1428 noted that certain classes were moved from jaxb-impl to jaxb-core, which caused Base64 to fail to statically initialize. ba4a6a4 updated the static initializer to attempt to not fail if jaxb was not enabled in Java 9. However, in Java8, if you have jaxb-impl on your classpath but not jaxb-core,
JAXBContext.newInstance()
fails with aNoClassDefFoundError
(which wraps aClassNotFoundException
), meaning that the exception is not caught and Base64 fails to initialize.The text was updated successfully, but these errors were encountered: