我正在尝试在JSF Web项目(Eclipse)中创建一个简单的RSS阅读器。
这是RSS的Primefaces片段:
<h:panelGrid>
<br/>
<h:outputText styleClass="font1" value="Travel feeds:"/>
<hr/>
<p:feedReader value="http://www.faroo.com/api?q=travel&l=en&src=news&f=rss" var="feed">
<a href="#{feed.link}" class="link">#{feed.title}</a>
<h:outputText value="#{feed.description.value}" escape="false"/>
<p:separator />
</p:feedReader>
</h:panelGrid>
我把它包含在同一页面中:
xmlns:p="http://primefaces.org/ui"
我使用“配置构建路径”包含的库如下:
primefaces-6.2-sources.jar,primefaces-6.2.jar,rome-1.0.jar
还尝试将它们直接复制到WEB-INF / libfolder,这也没有帮助。
那么实际问题是什么?
我有这样的例外:
exception
javax.servlet.ServletException: com/rometools/rome/io/XmlReader
javax.faces.webapp.FacesServlet.service(Unknown Source)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.NoClassDefFoundError: com/rometools/rome/io/XmlReader
org.primefaces.component.feedreader.FeedReaderRenderer.encodeEnd(FeedReaderRenderer.java:35)
javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(Unknown Source)
com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(Unknown Source)
com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(Unknown Source)
javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
javax.faces.webapp.FacesServlet.service(Unknown Source)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.ClassNotFoundException: com.rometools.rome.io.XmlReader
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
org.primefaces.component.feedreader.FeedReaderRenderer.encodeEnd(FeedReaderRenderer.java:35)
javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(Unknown Source)
com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(Unknown Source)
com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(Unknown Source)
javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
javax.faces.webapp.FacesServlet.service(Unknown Source)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.67 logs.
真的找不到解决方案。我错过了什么?我没有包含所需的.jar文件,或者我用错误的方式包含它们?
答案 0 :(得分:1)
PrimeFaces issuelist中提到的PrimeFaces 6.2问题的解决方案
在PrimeFaces文档中:
在迁移信息中:
你需要更新版本的罗马, 1.5.0 而不是1.0!
答案 1 :(得分:-1)
将Primefaces降级到5.3版本(从6. *开始)并包括jdom-1.1.1.jar库似乎已经解决了这个问题。 Primefaces RSS阅读器现在正在运行。不能说它是Primefaces版本问题,还是jdom依赖,或两者兼而有之。希望这至少可以为可能提出相同问题的人提供线索。
谢谢你的帮助,伙计们!