意外错误:java.security.InvalidAlgorithmParameterException:trustAnchors参数必须为非空

时间:2014-01-23 11:40:41

标签: java salesforce websphere

枝,

我编写了一个连接 Salesforce 的java代码,并在那里更新了一个值,当我从本地系统运行它作为独立的java应用程序时,它运行良好且良好但我的主要目标是将其作为filenet BPM工作流中的 java组件,因此当工作流程进入此 java组件时,它会抛出错误作为标题

整个堆栈跟踪如下

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

我搜索了有关此错误的所有内容,并生成了域的 .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");

顺便说一句,我甚至在WAS控制台中修改了密钥管理网和证书

但我继续犯同样的错误。不知道该怎么做,任何帮助都会很棒

先谢谢

1 个答案:

答案 0 :(得分:7)

此错误消息通常表示无法读取指定的信任库。我会检查:

  • 路径是否正确? (我确定你检查了这个......)
  • 启动JVM的用户是否有足够的访问权限来读取 trustore?
  • 您何时设置系统属性?它们是在调用Web服务时设置的吗?
  • 也许另一个组件已经覆盖了这些值。调用Web服务时是否仍设置了系统属性?
  • Trustore是否包含Salesforce证书且文件是否已损坏(例如,请与keytool -list联系)?

修改

  • 不要使用System.setProperty,而是在使用-Djavax.net.ssl.XXX启动Java进程时设置选项。此建议的原因如下:IBM安全框架可能会读取之前选项设置属性(例如,在类的static块中)。当然这是特定于框架的,可能会随版本而变化。