[ https://issues.apache.org/jira/browse/CRYPTO-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17787920#comment-17787920 ]
Sebb commented on CRYPTO-178: ----------------------------- For example, docker test using Ubuntu and invalid library name: $ docker compose -f src/docker/docker-compose.yaml run crypto mvn surefire:test -Dtest=OpenSslCryptoRandomTest -Djni.library.name=___ [+] Building 0.0s (0/0) docker:desktop-linux [+] Building 0.0s (0/0) docker:desktop-linux Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39) Maven home: /opt/maven Java version: 1.8.0_382, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "6.4.16-linuxkit", arch: "amd64", family: "unix" [INFO] Scanning for projects... [INFO] [INFO] -----------------< org.apache.commons:commons-crypto >------------------ [INFO] Building Apache Commons Crypto 1.2.1-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-surefire-plugin:3.1.2:test (default-cli) @ commons-crypto --- [INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.commons.crypto.random.OpenSslCryptoRandomTest [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.101 s <<< FAILURE! -- in org.apache.commons.crypto.random.OpenSslCryptoRandomTest [ERROR] org.apache.commons.crypto.random.OpenSslCryptoRandomTest -- Time elapsed: 0.101 s <<< ERROR! java.lang.ExceptionInInitializerError at org.apache.commons.crypto.random.OpenSslCryptoRandomTest.beforeAll(OpenSslCryptoRandomTest.java:34) at java.lang.reflect.Method.invoke(Method.java:498) at java.util.ArrayList.forEach(ArrayList.java:1259) Caused by: java.lang.IllegalStateException: java.security.GeneralSecurityException: Native library could not be initialized at org.apache.commons.crypto.random.OpenSslCryptoRandom.<clinit>(OpenSslCryptoRandom.java:67) ... 3 more Caused by: java.security.GeneralSecurityException: Native library could not be initialized at org.apache.commons.crypto.random.OpenSslCryptoRandom.checkNative(OpenSslCryptoRandom.java:77) at org.apache.commons.crypto.random.OpenSslCryptoRandom.<clinit>(OpenSslCryptoRandom.java:65) ... 3 more Caused by: java.lang.UnsatisfiedLinkError: Cannot load '___' (___: cannot open shared object file: No such file or directory)! at org.apache.commons.crypto.random.OpenSslCryptoRandomNative.initSR(Native Method) at org.apache.commons.crypto.random.OpenSslCryptoRandom.<clinit>(OpenSslCryptoRandom.java:54) ... 3 more [INFO] [INFO] Results: [INFO] [ERROR] Errors: [ERROR] OpenSslCryptoRandomTest.beforeAll:34 ExceptionInInitializer [INFO] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.202 s [INFO] Finished at: 2023-11-20T09:53:01Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-cli) on project commons-crypto: [ERROR] [ERROR] Please refer to /home/crypto/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException $ > OpenSslCryptoRandom.isNativeCodeEnabled() throws if library cannot be loaded > ---------------------------------------------------------------------------- > > Key: CRYPTO-178 > URL: https://issues.apache.org/jira/browse/CRYPTO-178 > Project: Commons Crypto > Issue Type: Bug > Reporter: Sebb > Priority: Major > > OpenSslCryptoRandom.isNativeCodeEnabled() currently throws an Exception if > the native cannout be found -- This message was sent by Atlassian Jira (v8.20.10#820010)