Java Rome XmlReader未读取https源

Java Rome XmlReader未读取https源,java,rss,feed,rss-reader,rome,Java,Rss,Feed,Rss Reader,Rome,我正在努力读书 使用罗马,但它给了我错误 INFO: Illegal access: this web application instance has been stopped already. Could not load org.bouncycastle.jcajce.provider.symmetric.AES$ECB. The eventual following stack trace is caused by an error thrown for debugging p

我正在努力读书

使用罗马,但它给了我错误

   INFO: Illegal access: this web application instance has been stopped already.  Could not load org.bouncycastle.jcajce.provider.symmetric.AES$ECB.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.

我正在这样做

    URL url =  new URL("https://d3ca01230439ce08d4aab0c61810af23:bla@mycon.mycompany.com/recordings.atom ");

    try {
    SyndFeedInput input = new SyndFeedInput();

        SyndFeed feed = input.build(new XmlReader(url));

        System.out.println("Feed Author:"+feed.getAuthor());

        for(Object entries: feed.getEntries()){

            SyndEntry entry = (SyndEntry) entries;

            System.out.println("title :"+entry.getTitle());
            System.out.println("description : "+entry.getDescription());

        }


    } catch (IllegalArgumentException | FeedException | IOException e) {
        e.printStackTrace();
    }
我需要把用户名密码放在什么地方吗

更新

这是我做的

  URL url =  new URL("https://d3ca01230439ce08d4aab0c61810af23:bla@mycon.mycompany.com/recordings.atom");

    HttpURLConnection httpcon = (HttpURLConnection)url.openConnection();

    String encoding = new sun.misc.BASE64Encoder().encode("username:pass".getBytes());

    httpcon.setRequestProperty  ("Authorization", "Basic " + encoding);

当我从浏览器中点击该URL时,它要求进行基本身份验证。你可以在罗马做到这一点:

URL feedUrl = new URL(feed)
HttpURLConnection httpcon = (HttpURLConnection)feedUrl.openConnection();
String encoding = new sun.misc.BASE64Encoder().encode("username:password".getBytes());
httpcon.setRequestProperty  ("Authorization", "Basic " + encoding);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(httpcon));
您可能不应该使用sun.misc.BASE64Encoder。我宁愿在别的地方再找一个


From:

我发现这一点在身份验证方面更具弹性,该代码可在有身份验证和无身份验证的情况下工作:

URL feedUrl = new URL("http://the.url.to/the/feed");
//URL feedUrl = new URL("http://user:pass@the.url.to/the/feed");

HttpURLConnection connection = (HttpURLConnection) feedUrl.openConnection();
if (feedUrl.getUserInfo() != null) {
    String encoding = new sun.misc.BASE64Encoder().encode(feedUrl.getUserInfo().getBytes());
    connection.setRequestProperty("Authorization", "Basic " + encoding);
}

SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(connection));

您还可以使用以下内容代替

String encoding = new sun.misc.BASE64Encoder().encode("username:password".getBytes());
为此:

String BASIC_AUTH = "Basic " + Base64.encodeToString("username:password".getBytes(), Base64.NO_WRAP);

嗨,大卫,谢谢你们的回复,我在上面尝试过,但我仍然得到服务器返回的HTTP响应代码:401,URL:error。我不明白你说的“可能不应该使用sun.misc.BASE64Encoder”是什么意思
String BASIC_AUTH = "Basic " + Base64.encodeToString("username:password".getBytes(), Base64.NO_WRAP);