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.



  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值