Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6596946

Using org.apache.commons.httpclient.* cause SunCertPathBuilderException

XMLWordPrintable

      J2SE Version (please include all output from java -version flag):
      C:\Documents and Settings\mac>java -version
      java version "1.6.0_03-ea"
      Java(TM) SE Runtime Environment (build 1.6.0_03-ea-b02)
      Java HotSpot(TM) Client VM (build 1.6.0_03-ea-b02, mixed mode, sharing)

      Operating System Configuration Information (be specific):
      Windows XP PRO SP2
      IE 7.0

      Hardware Configuration Information (be specific):
      Sony VAIO laptop 2.8 Gz
      1.25 GB RAM


      Bug Description:

      This is a follow-up on 6547437 which is stated as fixed, however it is only partially fixed. The renegotiation is fixed, but the initial socket still causes a exception
      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
      at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
      at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
      at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
      at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
      at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
      at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
      at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
      at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
      at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
      at java.io.BufferedOutputStream.flush(Unknown Source)
      at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(Unknown Source)
      at org.apache.commons.httpclient.HttpMethodBase.writeRequest(Unknown Source)
      at org.apache.commons.httpclient.HttpMethodBase.execute(Unknown Source)
      at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source)
      at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source)
      at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
      at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
      at ssltest.Main.callUsingApache(Main.java:178)
      at ssltest.Main.main(Main.java:109)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
      at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
      at sun.security.validator.Validator.validate(Unknown Source)
      at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source)
      at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
      at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
      ... 28 more
      Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
      at java.security.cert.CertPathBuilder.build(Unknown Source)
      ... 34 more



      Attached is a modified version of the test program submitted in for 6547437.


      Steps to Reproduce (be specific):

      No changes are necessary to the .java file

      Make sure the URLs in the jnlp file are both specified correctly.
      They should both have the host name : port of the machine with the JNLP file

      As submitted, the program will throw an exception
      "sslTest.listProxies" is "false"
      "sslTest.initJavaNetWithVerifier" is "false"

      Now change the JNLP file:
      In the jnlp file, set:
      "sslTest.listProxies" to "true"
      "sslTest.initJavaNetWithVerifier" to "false"
      The exception will not occur

      In the jnlp file, set
      "sslTest.listProxies" to "false"
      "sslTest.initJavaNetWithVerifier" to "true"
      The exception will not occur

            xuelei Xuelei Fan
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: