cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting Error unable to find valid certification path to requested target

Getting Error unable to find valid certification path to requested target

Al A.7
New member | Level 1

I'm trying to use the dropox java sdk. Trying to run a simple test. But I get the following error when running this code

DbxEntry.WithChildren listing = clientV1.getMetadataWithChildren("/");

 

com.dropbox.core.DbxException$NetworkIO: 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

 

This is strange, because httpurlconnection works fine going to https://www.dropbox.com  so the dropbox client cert is in my keystore. Is there another certificate that I need to import into my keystore that's missing?

Thanks

Al

 

 

5 Replies 5

Re: Getting Error unable to find valid certification path to requested target

Greg-DB
Dropboxer

What version of the SDK do you have, and how are you running this? The certificates are included in src/com/dropbox/core/http/trusted-certs.crt, but this should be handled for you. I.e., a trusted-certs.raw is generated during the Maven build, and you can see where it's loaded in SSLConfig.java.

Re: Getting Error unable to find valid certification path to requested target

Al A.7
New member | Level 1

I have dropbox-core-sdk-2.0-beta-3.jar file in my class path.I need to load the correct client certificates in my jvm cacerts file. 

Re: Getting Error unable to find valid certification path to requested target

Kannan G.1
Dropboxer

Immediately before calling getMetadataWithChildren(), can you add the following line:

    System.getProperties().list(System.out);

(You can also print to System.err if you prefer.)

That information might help us debug the issue.

Re: Getting Error unable to find valid certification path to requested target

Al A.7
New member | Level 1

A little more info. I'm calling this sdk from tomcat webapp on java 1.7. If I call the api's directly (calling the https://api.dropbox.com/1/metadata/auto/?locale=en_US&list=true&file_limit=25000) using httpsURLConnection from the same webapp the ssl handshake completes. So your client certificate is in the jvm cacerts file. 

But if I go through your SDK it fails with the error I gave you. I would rather use your sdk so I don't have to find all the URLs and then parse all the response json. 

Here is the properties list

 

-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
java.protocol.handler.pkgs=javax.net.ssl
sun.boot.library.path=C:\Udev\Hubble\jdk\jre\bin
java.vm.version=24.51-b03
shared.loader=
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
tomcat.util.buf.StringCache.byte.enabled=true
file.encoding.pkg=sun.io
user.script=
user.country=US
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
tomcat.util.scan.StandardJarScanFilter.jarsToScan=log4j-core*.jar,log4j-taglib*.jar
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\Udev\Hubble\tomcat\bin
java.runtime.version=1.7.0_51-b13
derby.system.home=C:\Udev\Hubble\Config
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Udev\Hubble\tomcat/common/endorsed
os.arch=amd64
java.io.tmpdir=C:\Udev\Hubble\tomcat\temp
line.separator=

java.vm.specification.vendor=Oracle Corporation
user.variant=
java.naming.factory.url.pkgs=org.apache.naming
os.name=Windows 7
sun.jnu.encoding=Cp1252
java.library.path=C:\Udev\Hubble\jdk\bin;C:\Udev\Hubble...
java.specification.name=Java Platform API Specification
java.class.version=51.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=6.1
sun.io.useCanonCaches=false
user.home=C:\Users\aaghili.MANAGEDMETHODS
user.timezone=America/Denver
catalina.useNaming=true
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.7
file.encoding=Cp1252
tomcat.util.scan.StandardJarScanFilter.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomc...
catalina.home=C:\Udev\Hubble\tomcat
user.name=aaghili
java.class.path=C:\Udev\Hubble\tomcat/bin/bootstrap.j...
java.naming.factory.initial=org.apache.naming.java.javaURLContext...
http.maxConnections=30
package.definition=sun.,java.,org.apache.catalina.,org.a...
java.vm.specification.version=1.7
sun.arch.data.model=64
java.home=C:\Udev\Hubble\jdk\jre
sun.java.command=org.apache.catalina.startup.Bootstrap...
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.7.0_51
java.ext.dirs=C:\Udev\Hubble\jdk\jre\lib\ext;C:\Win...
sun.boot.class.path=C:\Udev\Hubble\jdk\jre\lib\resources....
java.vendor=Oracle Corporation
server.loader=
catalina.base=C:\Udev\Hubble\tomcat
file.separator=\
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
common.loader="${catalina.base}/lib","${catalina.ba...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
package.access=sun.,org.apache.catalina.,org.apache....
sun.desktop=windows
sun.cpu.isalist=amd64

 

 

 

 

Re: Getting Error unable to find valid certification path to requested target

Kannan G.1
Dropboxer

Al, I wrote a short test program that makes HTTP requests to Dropbox servers using the SDK.  Can you try running it on your machine?

Link: https://www.dropbox.com/s/uex1nmzombsa0pu/cert-chain.zip

See "ReadMe.txt" for instructions on how to compile and run it.

Who's talking

Top contributors to this post

  • User avatar
    Kannan G.1 Dropboxer
  • User avatar
    Al A.7 New member | Level 1
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?