0
내가 던진 예외는 ... 사용 RSSUtil는 RSS 피드를 읽어하지만 난 클래스 로더에 문제에 직면하고있어을 Liferay RSSUtil + rome.jar
싶습니다 :
com.sun.syndication.feed.synd.SyndFeedImpl cannot be cast to com.sun.syndication.feed.synd.SyndFeedImpl
내 코드 :
SyndFeedImpl feed = null;
final String _CLASS_NAME = "com.liferay.portlet.rss.util.RSSUtil";
MethodKey _CONSTRUCTOR = new MethodKey(_CLASS_NAME, "getFeed", String.class);
ObjectValuePair ovp = (ObjectValuePair) PortalClassInvoker.invoke(true, _CONSTRUCTOR, url);
Class<SyndFeed> clazz = (Class<SyndFeed>) PortalClassLoaderUtil.getClassLoader().loadClass(
"com.sun.syndication.feed.synd.SyndFeedImpl");
feed = (SyndFeedImpl) ovp.getValue();
문제는 https://www.liferay.com/fr/community/forums/-/message_boards/message/15812507에도 설명되어 있습니다. 저도 같은 일을하려고하지만 ... 당신의 도움에 미리
감사합니다 ...
UPDATE를 작동하지 않습니다
: 나는 아래의 코드 (RSSUtil없이 다른 솔루션)를 사용하는 경우 URL feedUrl = new URL(url);
HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection();
SyndFeedInput input = new SyndFeedInput();
XmlReader reader = new XmlReader(httpcon);
SyndFeed feed = input.build(reader);
던져 예외입니다 :
java.lang.ClassCastException: com.sun.syndication.feed.synd.impl.ConverterForAtom10 cannot be cast to com.sun.syndication.feed.synd.Converter