意外错误:java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21307118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
提问by Bharath R
Hie,
嗨,
I wrote a java code which connects to Salesforceand updates a value in there, Its is working well and good when i run it from my local system as a standalone java applicationbut my main goal is to take that as a java component in filenet BPM workflow, so when the workflow process gets to this java component then it throws a error as the title
我编写了一个连接到Salesforce并更新其中的值的 Java 代码,当我从本地系统将它作为独立的 Java 应用程序运行时,它运行良好,但我的主要目标是将其作为filenet BPM 中的Java 组件工作流,所以当工作流进程到达这个java组件时,它会抛出一个错误作为标题
the entire stack stack trace is as follows
整个堆栈堆栈跟踪如下
com.sforce.ws.ConnectionException: Failed to send request to https://login.salesforce.com/services/Soap/c/24.0/0DF90000000PX8r
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:129)
at com.sforce.soap.enterprise.EnterpriseConnection.login(EnterpriseConnection.java:1052)
at com.sforce.soap.enterprise.EnterpriseConnection.<init>(EnterpriseConnection.java:399)
at salesforceupdate.SalesForceUpdate.main(SalesForceUpdate.java:70)
at salesforceupdate.Callin.UpdateSL(Callin.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at filenet.vw.integrator.adaptors.java.VWJavaAdaptor.execute(VWJavaAdaptor.java:426)
at filenet.vw.integrator.base.VWAdaptorEx$AdaptorAction.run(VWAdaptorEx.java:120)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:727)
at filenet.vw.integrator.base.VWAdaptorEx.run(VWAdaptorEx.java:360)
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at com.ibm.jsse2.n.a(n.java:42)
at com.ibm.jsse2.tc.a(tc.java:96)
at com.ibm.jsse2.tc.a(tc.java:340)
at com.ibm.jsse2.tc.a(tc.java:555)
at com.ibm.jsse2.tc.a(tc.java:510)
at com.ibm.jsse2.tc.startHandshake(tc.java:381)
at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:151)
at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:64)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1024)
at com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(b.java:51)
at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:115)
at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:79)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:107)
... 13 more
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at com.ibm.jsse2.util.e.<init>(e.java:117)
at com.ibm.jsse2.util.d.a(d.java:20)
at com.ibm.jsse2.hc.a(hc.java:58)
at com.ibm.jsse2.hc.checkServerTrusted(hc.java:88)
at filenet.ws.utils.jsse.FnTrustManager.checkServerTrusted(FnTrustManager.java:156)
at com.ibm.jsse2.hb.a(hb.java:382)
at com.ibm.jsse2.hb.a(hb.java:23)
at com.ibm.jsse2.gb.n(gb.java:295)
at com.ibm.jsse2.gb.a(gb.java:269)
at com.ibm.jsse2.tc.a(tc.java:347)
at com.ibm.jsse2.tc.g(tc.java:416)
at com.ibm.jsse2.tc.a(tc.java:60)
... 21 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:287)
at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:143)
at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:101)
at com.ibm.jsse2.util.e.<init>(e.java:17)
... 32 more
I have googled everything regarding this error and generated a .crtfile of the domain and created a keystorefile and mentioned that in my code
我已经搜索了有关此错误的所有内容并生成了域的.crt文件并创建了一个密钥库文件并在我的代码中提到了这一点
System.setProperty("javax.net.ssl.trustStore","C:\Program Files\IBM\WebSphere\AppServer\java\jre\bin\secure.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "xxxxx");
By the way i even modified key managemnet and certificates in WAS console
顺便说一句,我什至在 WAS 控制台中修改了密钥管理网和证书
But I keep on getting the same error..Don't know what to do , Any help would be great
但我不断收到同样的错误..不知道该怎么做,任何帮助都会很棒
Thanks in Advance
提前致谢
回答by Peter Keller
This error message usually means that your specified truststore can not be read. What I would check:
此错误消息通常表示无法读取您指定的信任库。我会检查什么:
- Is the path correct? (I'm sure you checked this...)
- Has the user who started the JVM enough access privileges to read the trustore?
- When do you set the system properties? Are they already set when the webservice is invoked?
- Perhaps another component has overridden the values. Are the system properties still set when the webservice is invoked?
- Does the trustore contains the Salesforce certificate and is the file not corrupt (e.g. check with
keytool -list
)?
- 路径是否正确?(我确定你检查过这个......)
- 启动 JVM 的用户是否有足够的访问权限来读取信任库?
- 什么时候设置系统属性?调用 webservice 时它们是否已经设置?
- 也许另一个组件覆盖了这些值。调用 webservice 时是否仍设置系统属性?
- trustore 是否包含 Salesforce 证书并且文件没有损坏(例如检查
keytool -list
)?
Edit:
编辑:
- Don't use
System.setProperty
but set the options when starting the Java process with-Djavax.net.ssl.XXX
. The reason for this advice is as follows: The IBM security framework may read the options beforeyou set the property (e.g. in astatic
block of a class). Of course this is framework specific and may change from version to version.
- 不要使用
System.setProperty
,但首先是Java进程时设置的选项-Djavax.net.ssl.XXX
。这个建议的原因如下:IBM 安全框架可能会在您设置属性之前读取这些选项(例如,在static
类的块中)。当然,这是特定于框架的,可能会因版本而异。