【问题标题】:Java Truststore differences between windows 7 and Solaris (Mule 3.3)Windows 7 和 Solaris (Mule 3.3) 之间的 Java 信任库差异
【发布时间】:2012-05-31 07:59:07
【问题描述】:

我有两个我希望在同一个 JVM 中运行的模块。两者都使用 Mule 3.3 和两者都需要与特定的外部服务建立 https 连接。

模块 A 使用特定的 https 连接器:

<https:connector name="proxiedHttpsConnector">
    <spring:property name="proxyHostname" value="${feeds.proxy.server}"/>
    <spring:property name="proxyPort" value="${feeds.proxy.port}"/>
    <https:tls-server path="security/modulea_store" storePassword="thesecretpassowrd"/>
</https:connector>

模块 B 使用使用 com.sun.jersey.client.apache.ApacheHttpClient (v 1.6) 的第三方代码。模块 B 已修改为通过相同的代理工作。

在使用 jdk1.6.0_27 在 Windows 7 上测试模块 B 时,我收到以下异常:

ERROR 2012-05-09 10:02:39,585 [VideoAvailable.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Component that caused exception is: DefaultJavaComponent{VideoAvailable.commponent.414853995}. Message payload is of type: VideoEvent
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. unable to find valid certification path to requested target (sun.security.provider.certpath.SunCertPathBuilderException)
  sun.security.provider.certpath.SunCertPathBuilder:174 (null)
2. PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (sun.security.validator.ValidatorException)
  sun.security.validator.PKIXValidator:323 (null)
3. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (javax.net.ssl.SSLHandshakeException)
  com.sun.net.ssl.internal.ssl.Alerts:174 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLHandshakeException.html)
4. javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (com.sun.jersey.api.client.ClientHandlerException)
  com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor:213 (null)
5. Component that caused exception is: DefaultJavaComponent{VideoAvailable.commponent.414853995}. Message payload is of type: VideoEvent (org.mule.component.ComponentException)
  org.mule.component.DefaultComponentLifecycleAdapter:359 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:318)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我可以将连接到模块 B 的远程服务的证书添加到模块 A 的信任库,并且两个模块在 Windows 7 上都可以正常工作。

在运行 jre 1.6.0_06 的 SunOS 5.10 上运行相同的配置(我知道它很旧), 产生以下错误:

2012/05/08 17:42:32 | ERROR 2012-05-08 17:42:32,265 [VideoAvailable.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy: 
2012/05/08 17:42:32 | ********************************************************************************
2012/05/08 17:42:32 | Message               : Component that caused exception is: DefaultJavaComponent{VideoAvailable.commponent.6015177}. Message payload is of type: VideoEvent
2012/05/08 17:42:32 | Code                  : MULE_ERROR--2
2012/05/08 17:42:32 | --------------------------------------------------------------------------------
2012/05/08 17:42:32 | Exception stack is:
2012/05/08 17:42:32 | 1. the trustAnchors parameter must be non-empty (java.security.InvalidAlgorithmParameterException)
2012/05/08 17:42:32 |   java.security.cert.PKIXParameters:183 (null)
2012/05/08 17:42:32 | 2. Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty (java.lang.RuntimeException)
2012/05/08 17:42:32 |   sun.security.validator.PKIXValidator:59 (null)
2012/05/08 17:42:32 | 3. java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty (javax.net.ssl.SSLException)
2012/05/08 17:42:32 |   com.sun.net.ssl.internal.ssl.Alerts:190 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLException.html)
2012/05/08 17:42:32 | 4. javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty (com.sun.jersey.api.client.ClientHandlerException)
2012/05/08 17:42:32 |   com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor:213 (null)
2012/05/08 17:42:32 | 5. Component that caused exception is: DefaultJavaComponent{VideoAvailable.commponent.6015177}. Message payload is of type: VideoEvent (org.mule.component.ComponentException)
2012/05/08 17:42:32 |   org.mule.component.DefaultComponentLifecycleAdapter:359 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html)
2012/05/08 17:42:32 | --------------------------------------------------------------------------------
2012/05/08 17:42:32 | Root Exception stack trace:
2012/05/08 17:42:32 | java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
2012/05/08 17:42:32 |   at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:183)
2012/05/08 17:42:32 |   at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:103)
2012/05/08 17:42:32 |   at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:87)
2012/05/08 17:42:32 |     + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
2012/05/08 17:42:32 | ********************************************************************************

两者都可以在 Windows 7 和 SunOS 上独立运行。两者都在 Windows 7 上运行良好。 两者在 SunOS 上都不兼容。此外,将模块 B 所需的证书添加到 /NFL/ESB/apps/jdk1.6.0_06/jre/lib/security/cacerts 和弹跳骡子没有帮助。我还尝试将我的 Windows 7 JDK 配置为指向 SunOS cacerts 的副本(默认)并且没有重现 Sun 错误。

【问题讨论】:

    标签: java mule truststore


    【解决方案1】:

    您是否有可能使用“\”作为路径分隔符,因此在 SunOS 上失败了?

    【讨论】:

    • 欣赏评论,SunOS 上的任何路径中都没有“\”。此外,我在 SunOS 机器上尝试了更新版本的 JDK,并且行为是相同的。核心问题是在 Windows 7 和 SunOS 中运行两个模块时,默认信任库的初始化方式不同。
    【解决方案2】:

    我能够重新配置模块 A 以使用默认的信任库:

    <https:connector name="proxiedHttpsConnector"
         http:proxyHostname="${feeds.proxy.server}"
         http:proxyPort="${feeds.proxy.port}"/>
    

    然后允许两个模块一起运行。

    就主要目标而言,这很好用。我从未完全解开 Windows 7 和 Solaris 之间不同的信任库初始化路径 但在这个问题上花了足够的时间,我需要继续前进。

    【讨论】:

      猜你喜欢
      • 2011-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-19
      • 2023-03-31
      • 2015-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多