Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at javax.crypto.JceSecurity.(JceSecurity.java:93)
... 33 more
Caused by: java.lang.SecurityException: Cannot locate policy or framework files!
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:316)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:50)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.(JceSecurity.java:82)
这是由于jce包不对,去oracle官方下载一个对应版本的jce包替换掉即可。
java8的在http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
解压后有三个文件:
README.txt
local_policy.jar
US_export_policy.jar
看README.txt就了解怎么用了,我是将<JAVA_HOME> /jre/lib/security/policy/unlimited
里的两个文件替换 。