4

我正在运行一个 3rd 方应用程序,它在尝试创建与服务器的 SSL 连接时失败并显示以下堆栈跟踪:

根本的例外是:

Caused by: java.lang.SecurityException: Toolkit not encapsulated by a jar.
    at com.rsa.jcm.f.hq.a(Unknown Source)    
    at com.rsa.jcm.f.jg.b(Unknown Source)
    at com.rsa.crypto.jcm.ModuleLoader.a(Unknown Source)
    at com.rsa.crypto.jcm.ModuleLoader.load(Unknown Source)
    ... 43 more

有没有人看到通过使用 RSA 的 SSL 连接时发生这种情况?我在谷歌工作过,但没有任何明显的原因说明为什么会发生这种情况。

这个特殊的错误发生在 Mac 上,我有一个可以正常工作的相同应用程序的 Windows 版本。主要区别在于它们在 Windows 版本中捆绑了 JRE,因此我检查了各种安全策略等,但 Windows 上的 JRE 与我的 Mac 上的 JRE 没有太大区别。

完整的堆栈跟踪如下所示:

Caused by: java.lang.Error: Problem loading module.
    at com.rsa.cryptoj.o.ju.g(Unknown Source)
    at com.rsa.cryptoj.o.ju.c(Unknown Source)
    at com.rsa.cryptoj.o.gd.a(Unknown Source)
    at com.rsa.cryptoj.o.dm.b(Unknown Source)
    at com.rsa.cryptoj.o.dm.<clinit>(Unknown Source)
    at com.rsa.cryptoj.o.me.newInstance(Unknown Source)
    at javax.crypto.Cipher.chooseProvider(Cipher.java:845)
    at javax.crypto.Cipher.init(Cipher.java:1348)
    at sun.security.ssl.CipherBox.<init>(CipherBox.java:175)
    at sun.security.ssl.CipherBox.newCipherBox(CipherBox.java:208)
    at sun.security.ssl.CipherSuite$BulkCipher.newCipher(CipherSuite.java:467)
    at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:507)
    at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:485)
    at sun.security.ssl.CipherSuite.isAvailable(CipherSuite.java:190)
    at sun.security.ssl.SSLContextImpl.getApplicableCipherSuiteList(SSLContextImpl.java:342)
    at sun.security.ssl.SSLContextImpl.getDefaultCipherSuiteList(SSLContextImpl.java:300)
    at sun.security.ssl.SSLSocketImpl.init(SSLSocketImpl.java:576)
    at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:512)
    at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:73)
    at com.somevendor.client.common.spring.remoting.http.e.createSocket(Unknown Source)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at com.somevendor.client.common.spring.remoting.http.SecureHttpInvokerRequestExecutor.executePostMethod(Unknown Source)
    at org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.doExecuteRequest(CommonsHttpInvokerRequestExecutor.java:140)
    at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:136)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:192)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:174)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:142)
    ... 7 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    ... 39 more
Caused by: java.lang.SecurityException: Toolkit not encapsulated by a jar.
    at com.rsa.jcm.f.hq.a(Unknown Source)
    at com.rsa.jcm.f.jg.b(Unknown Source)
    at com.rsa.crypto.jcm.ModuleLoader.a(Unknown Source)
    at com.rsa.crypto.jcm.ModuleLoader.load(Unknown Source)
    ... 43 more
4

1 回答 1

0

在我解决问题时回答(5年前..)。当执行的 jar 文件的完全限定路径中有空格时,会发生此异常。

所以这有效:

/Users/stringy05/app/app.jar

但是,如果您使用带空格的路径:

/Volumes/Macintosh HD/Users/stringy05/app/app.jar 

然后它失败了。最初发生这种情况时,我在 /Users/stringy05 中有一个指向另一个硬盘的软链接,因此 java 或操作系统正在将链接路径解析为真实路径,它会失败。

于 2018-07-03T23:30:12.277 回答