0

When I am using this code to parse a rss xml source(the app using embedded tomcat and running in CentOS 7.x, using Java 11 AdoptJDK):

package com.dolphin.soa.post;

import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.SyndFeedInput;
import com.rometools.rome.io.XmlReader;
import lombok.extern.slf4j.Slf4j;

import java.net.URL;

/**
 * @author dolphin
 */
@Slf4j
public class MiniExample {

    public static void main(String[] args) {
        try {
            URL url = new URL("https://zpblogs.cn/feed/");
            SyndFeed feed = new SyndFeedInput().build(new XmlReader(url));
            System.out.print(feed.getCopyright());
        }catch (Exception e){
            log.error("error",e);
        }
    }
}

this is the package I am using:

api "com.rometools:rome:1.15.0"

but show this error:

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

why woud this happen? I have read this question, all tell that should using keytool to import the cert, but my rrs url has more than 1000000+, import the cert one by one, seems it hard to implement? what should I do to fix this problem?

  1. How much certificate organization the Java trust?
  2. How java determine which certificate organization should trust?
  3. how to know the certificate in the trust chain?
  4. Is it a good practice to trust all certificate?
Dolphin
  • 13,739
  • 26
  • 110
  • 272
  • The error message (or the stack trace) should include the name of the missing certificate. Start by adding just that certificate to the Java _keystore_ and see if it solves the problem. – Abra Aug 01 '21 at 11:22

0 Answers0