Analysis and solution of RSA premaster secret error

Problem description
Java is packaged and runs with Java-XMx1g-java.ext.dirs =lib2 Runner XX.
error: RSA premaster secret error
test has no problem, it can run locally and the result is correct; The server can run, but the results are incorrect. Report the above error.
Problem analysis
Java-cp XX. Jar YY is operational.
java-djava.ext.dirs will not run.
After java-java.ext.dirs loads the Lib, the JAR package under %JAVA_HOME%\ jRE \ Lib \ext will not load.
is queried, involving sunjce_provider.jar.
Solution 1
Find Sunjce, copy it to lib, and run the solution.

echo $JAVA_HOME  
> find $JAVA_HOME -iname "*sunjce*jar"   # find sunjce
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunjce_provider.jar

Just copy this into lib.
Solution 2
You just have to load the JAR package under Ext, otherwise it’s a problem.
for example: java-java.ext.dirs =lib:$JAVA_HOME/jre/lib/ ext-jar build/ myappjar.jar
conclusion

    cp makes use of the current jar package and the lib/ext directory jar package in the jre, -d does not. Copy the past jar

if necessary
Refer to the reference
https://stackoverflow.com/questions/21390157/rsa-premaster-secret-error

Read More: