在我的scala项目中,我使用"org.bouncycastle" % "bcprov-jdk14" % "1.51"
进行加密
如果它在Scala IDE中测试我的项目,它可以正常工作。但是,一旦我创建了一个JAR并尝试通过java -jar ...
运行它,就会引发异常:Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider BC
我使用https://github.com/sbt/sbt-assembly制作JAR,这是我的java -version
输出:
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) Server VM (build 24.72-b04, mixed mode)
制作JAR时,我看到了这个输出:
[info] Merging files...
[warn] Merging 'META-INF/BCKEY.DSA' with strategy 'discard'
[warn] Merging 'META-INF/BCKEY.SF' with strategy 'discard'
[warn] Merging 'META-INF/LAMBDAWO.SF' with strategy 'discard'
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Merging 'reference.conf' with strategy 'concat'
[warn] Merging 'rootdoc.txt' with strategy 'concat'
[warn] Strategy 'concat' was applied to 2 files
[warn] Strategy 'discard' was applied to 4 files
如何解决此问题?