0

I was running a web-application where the code downloads an https://....jpeg file but it fails with error

"javax.imageio.IIOException ... "Can't get input stream from URL!"" 
 underlying exception is javax.net.ssl.SSLHandshakeException: 
 sun.security.validator.ValidatorException: PKIX path building failed

The same image i am able to view in my browswer. The image is i am able to download/read via a standalone program in java - URL url = new URL(...); Image image = ImageIO.read(url);

Where as the same gets failed when it tries to download in web application server side code from tomcat.

On search there are various explanations given in stackoverflow.

  1. Getting images from https with Java
  2. Getting Image from URL (Java)
  3. Download file from HTTPS server using Java

The https image URL would of the same server or different server. However the images works fine via browser and standalone program.

Question:

  1. Is any special treatment required to access https image from web app?
  2. How does it works in standalone program but not via web app though the certs are not installed in local machine?

What is the right approach and what is the underlying differences?

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Int Prep
  • 1
  • 1

0 Answers0