掲示板

Exception when generating RSS Feeds on JBoss

12年前 に Jonny Olliff-Lee によって更新されました。

Exception when generating RSS Feeds on JBoss

Junior Member 投稿: 48 参加年月日: 11/01/25 最新の投稿
Hi all!

I'm building a portlet that generates RSS feeds, I know Liferay does this out of the box, but the items in my feeds are coming from another datasource (and not the Liferay database).

I'm using the Stax XML library to the legwork of writing the XML, and my code works fine on my local & development Tomcat 6 servers. When I deployed the code to a JBoss Server I get the following exception when the feeds are generated:

javax.xml.stream.XMLStreamException: Can not write DOCTYPE declaration (DTD) when not in prolog any more (state 2; start element(s) written)


Now I had a look around, and my understanding of this error is that the declaration of the XML schema (i.e. the top line) has been written to the file after the root element? So I have two questions:

1) Is my understanding correct?

2) Why would this only occur on a JBoss Server, and not on any of the Tomcat servers I've tested it on?

Thanks for your help.
thumbnail
12年前 に Hitoshi Ozawa によって更新されました。

RE: Exception when generating RSS Feeds on JBoss

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Tomcat is more relaxed toward standards.
12年前 に Jonny Olliff-Lee によって更新されました。

RE: Exception when generating RSS Feeds on JBoss

Junior Member 投稿: 48 参加年月日: 11/01/25 最新の投稿
Hitoshi Ozawa:
Tomcat is more relaxed toward standards.


Thanks Hitoshi. That makes sense, however I have run my feeds through the W3C RSS 2.0 Validator it comes back as valid?
12年前 に Jonny Olliff-Lee によって更新されました。

RE: Exception when generating RSS Feeds on JBoss

Junior Member 投稿: 48 参加年月日: 11/01/25 最新の投稿
For anyone interested, I solved this by using the ROME RSS library which can be found here along with a tutorial as to how to use it.