Castillo hinchable en SpringBoot

Cuando ejecuto mi aplicación Springboot como un archivo jar, aparece el siguiente error. El problema no ocurre cuando ejecuto mi proyecto con el IDE. ¿Me podrían ayudar con una solución? ¡gracias!.

2022-01-14 23:34:58.885  INFO 4247 --- [nio-8080-exec-2] c.o.b.h.s.internal.BouncyCastleHelper    : Instantiated provider: org.bouncycastle.jce.provider.BouncyCastleProvider
com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier$PEMFileRSAPrivateKeySupplierException: org.bouncycastle.openssl.PEMException: exception processing key pair: JCE cannot authenticate the provider BC
    at com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier.<init>(PEMFileRSAPrivateKeySupplier.java:118)
    at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createKeySupplier(DefaultRequestSignerFactory.java:111)
    at com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory.createRequestSigner(DefaultRequestSignerFactory.java:54)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:284)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:218)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:181)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:146)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:118)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:93)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:70)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:56)
    at com.oracle.bmc.objectstorage.ObjectStorageClient.<init>(ObjectStorageClient.java:45)

......


Caused by: org.bouncycastle.openssl.PEMException: exception processing key pair: JCE cannot authenticate the provider BC
    at org.bouncycastle.openssl.PEMEncryptedKeyPair.decryptKeyPair(Unknown Source)
    at com.oracle.bmc.http.signing.internal.PEMFileRSAPrivateKeySupplier.<init>(PEMFileRSAPrivateKeySupplier.java:94)
    ... 112 more
Caused by: java.lang.SecurityException: JCE cannot authenticate the provider BC
    at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:143)
    at java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:248)
    at org.bouncycastle.jcajce.util.ProviderJcaJceHelper.createSecretKeyFactory(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source)
    at org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder$1$1.decrypt(Unknown Source)
    ... 114 more
Caused by: java.lang.IllegalStateException: zip file closed
    at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:829)
    at java.base/java.util.zip.ZipFile.getManifestName(ZipFile.java:1055)
    at java.base/java.util.zip.ZipFile$1.getManifestName(ZipFile.java:1098)
    at java.base/javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:460)
    at java.base/javax.crypto.JarVerifier.verifyJars(JarVerifier.java:316)
    at java.base/javax.crypto.JarVerifier.verify(JarVerifier.java:259)
    at java.base/javax.crypto.ProviderVerifier.verify(ProviderVerifier.java:129)
    at java.base/javax.crypto.JceSecurity.verifyProvider(JceSecurity.java:189)
    at java.base/javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:217)
    at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:139)
    ... 120 more
Answer

Esto se debe a un error en Spring Boot que se rastrea en este problema: https://github.com/spring-projects/spring-boot/issues/28837 .

El problema es específico del JDK 17 de Oracle. Si el cambio de JDK es una opción, puede cambiar a Oracle JDK 11. Alternativamente, cualquier versión de OpenJDK (8, 11 y 17 son compatibles) también debería evitar el problema.