Maven编译错误:Could not generate DH keypair: Prime size must be multiple of 64...

Maven编译时报如下错误:

[ERROR] Failed to execute goal on project hadoop-hdfs: Could not resolve dependencies for project org.apache.hadoop:hadoop-hdfs:jar:2.0.0-cdh4.5.0: Failed to collect dependencies at commons-daemon:commons-daemon:jar:1.0.3: Failed to read artifact descriptor for commons-daemon:commons-daemon:jar:1.0.3: Could not transfer artifact commons-daemon:commons-daemon:pom:1.0.3 from/to apache.snapshots.https (https://repository.apache.org/content/repositories/snapshots): java.lang.RuntimeException: Could not generate DH keypair: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive) -> [Help 1]


查询参考:

1. http://stackoverflow.com/questions/6851461/java-why-does-ssl-handshake-give-could-not-generate-dh-keypair-exception

2. http://www.codified.com/maven-build-error-java-lang-runtimeexception-could-not-generate-dh-keypair/


采用如下解决方式:

1. Download the BouncyCastle JCE jars. These particular links are for version 1.52 and work for Oracle Java 5 – Java 8.
https://www.bouncycastle.org/download/bcprov-jdk15on-152.jar
https://www.bouncycastle.org/download/bcprov-ext-jdk15on-152.jar
OR:
http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on/1.52
http://mvnrepository.com/artifact/org.bouncycastle/bcprov-ext-jdk15on/1.52

2. Copy jars to $JAVA_HOME/jre/lib/ext
3. Edit $JAVA_HOME/jre/lib/security/java.security as follows:
    Set “security.provider.2” to org.bouncycastle.jce.provider.BouncyCastleProvider 
    security.provider.2=org.bouncycastle.jce.provider.BouncyCastleProvider

security.provider.1=sun.security.provider.Sun
#security.provider.2=sun.security.rsa.SunRsaSign
security.provider.2=org.bouncycastle.jce.provider.BouncyCastleProvider
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC


4. Re-run the maven build and the errors should now be gone.




你可能感兴趣的:(Maven编译错误:Could not generate DH keypair: Prime size must be multiple of 64...)