我们需要在IBM AIX 6.1中部署一个独立的jar。该jar尝试使用hierynomus sshj和bouncycastle连接到SFTP服务器。尝试实例化KeyAgreement时,在执行时,它将输出以下内容:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:172)
at java.security.Provider$Service$1.run(Provider.java:831)
at java.security.Provider$Service$1.run(Provider.java:823)
at java.security.AccessController.doPrivileged(AccessController.java:202)
at java.security.Provider$Service.newInstance(Provider.java:821)
at java.security.SecureRandom.<init>(SecureRandom.java:114)
at javax.crypto.b.<clinit>(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at javax.crypto.KeyAgreement.getInstance(Unknown Source)
at net.schmizz.sshj.common.SecurityUtils.registerSecurityProvider(SecurityUtils.java:88)
at net.schmizz.sshj.common.SecurityUtils.register(SecurityUtils.java:267)
at net.schmizz.sshj.common.SecurityUtils.isBouncyCastleRegistered(SecurityUtils.java:245)
at net.schmizz.sshj.DefaultConfig.<init>(DefaultConfig.java:78)
at net.schmizz.sshj.SSHClient.<init>(SSHClient.java:135)
at com.dxc.seat.eai.EailSftpClient.getConnection(EailSftpClient.java:312)
at com.dxc.seat.eai.EailSftpClient.startProcess(EailSftpClient.java:200)
at com.dxc.seat.eai.SFTPFileInput.main(SFTPFileInput.java:17)
Caused by: java.lang.NullPointerException
at org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV.engineGenerateSeed(Unknown Source)
at java.security.SecureRandom.generateSeed(SecureRandom.java:343)
at org.bouncycastle.jcajce.provider.drbg.DRBG$HybridSecureRandom.<init>(Unknown Source)
at org.bouncycastle.jcajce.provider.drbg.DRBG.createBaseRandom(Unknown Source)
at org.bouncycastle.jcajce.provider.drbg.DRBG.access$200(Unknown Source)
at org.bouncycastle.jcajce.provider.drbg.DRBG$Default.<clinit>(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 19 more
用于运行此jar的JVM是:
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap6460sr9fp1ifix-20110511(SR9 P1+IZ97552))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc64-64 jvmap6460sr9-20110203_74623 (JIT enabled, AOT enabled)
J9VM - 20110203_074623
JIT - r9_20101028_17488ifx3
GC - 20101027_AA)
JCL - 20110203_01
通过将新的安全提供程序附加到java.security的提供程序列表的末尾并添加库来更新JVM安全设置: bcpkix-jdk15on-1.60.jar bcprov-jdk15on-1.60.jar到ext目录。
独立jar是使用maven-assembly-plugin构建的。
我们想知道为什么会这样以及我们如何解决它。