Only whitespace content allowed before start tag when trying to view project within JIRA Software
Symptoms
Trying to while a particular project within JIRA Software results in a huge stack trace dump in the browser.
The following appears in the atlassian-jira.log
:
2012-06-21 15:30:59,960 http-443-24 ERROR jira 930x1724x1 1g1zmie xxx.xxx.xxx.xxx /secure/VersionBoard.jspa [com.atlassian.velocity.DefaultVelocityManager] MethodInvocationException occurred getting message body from Velocity: com.thoughtworks.xstream.io.StreamException: : only whitespace content allowed before start tag and not ! (position: START_DOCUMENT seen !... @1:1)
com.thoughtworks.xstream.io.StreamException: : only whitespace content allowed before start tag and not ! (position: START_DOCUMENT seen !... @1:1)
at com.thoughtworks.xstream.io.xml.XppReader.next(XppReader.java:83)
at com.thoughtworks.xstream.io.xml.XppReader.read(XppReader.java:135)
at com.thoughtworks.xstream.io.xml.XppReader.moveDown(XppReader.java:94)
at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:31)
at com.thoughtworks.xstream.io.xml.XppDriver.createReader(XppDriver.java:22)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:505)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:496)
at com.pyxis.greenhopper.jira.configurations.UserBoardsPreferences.loadFromDatabase(UserBoardsPreferences.java:347)
at com.pyxis.greenhopper.jira.configurations.UserBoardsPreferences.<init>(UserBoardsPreferences.java:65)
at com.atlassian.greenhopper.service.configuration.UserBoardsPreferencesServiceImpl.getUserPreferences(UserBoardsPreferencesServiceImpl.java:52)
at com.atlassian.greenhopper.service.configuration.UserBoardsPreferencesServiceImpl.getPreferences(UserBoardsPreferencesServiceImpl.java:39)
at com.pyxis.greenhopper.jira.boards.context.DefaultBoardContext.getPreferences(DefaultBoardContext.java:204)
at com.pyxis.greenhopper.jira.configurations.context.ContextImpl.<init>(ContextImpl.java:55)
at com.pyxis.greenhopper.jira.configurations.context.DefaultContext.<init>(DefaultContext.java:14)
at com.pyxis.greenhopper.jira.configurations.context.Contexts.getDefaultContext(Contexts.java:136)
at com.pyxis.greenhopper.jira.configurations.context.Contexts.get(Contexts.java:28)
at com.pyxis.greenhopper.jira.configurations.UserBoardSettings.getSelectedContext(UserBoardSettings.java:112)
at com.pyxis.greenhopper.jira.boards.context.DefaultBoardContext.getSelectedContext(DefaultBoardContext.java:319)
...
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not ! (position: START_DOCUMENT seen !... @1:1)
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1487)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1363)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061)
at com.thoughtworks.xstream.io.xml.XppReader.next(XppReader.java:81)
... 194 more
Cause
JIRA Software's configurations are stored as XML within the database. With that, if the XML is invalid, it can result in the above.
For example, a normal entry may look like this:
id | propertyvalue
------------------------
10399 | <map>
: <entry>
: <string>GH_gh.issue.releasedVersionHistoryField</string>
: <string>customfield_10006</string>
: </entry>
: <entry>
: <string>FIX_VERSION_SYNCHER</string>
: <boolean>false</boolean>
: </entry>
: <entry>
: <string>gh.configuration.rapidboard.scrum</string>
: <boolean>true</boolean>
: </entry>
: </map>
Problematic entry:
id | propertyvalue
------------------------
10399 | ![CDATA[<map>
: <entry>
: <string>GH_gh.issue.releasedVersionHistoryField</string>
: <string>customfield_10006</string>
: </entry>
: <entry>
: <string>FIX_VERSION_SYNCHER</string>
: <boolean>false</boolean>
: </entry>
: <entry>
: <string>gh.configuration.rapidboard.scrum</string>
: <boolean>true</boolean>
: </entry>
: </map>]]
Workaround
Remove the problematic entry from both the propertyentry and propertytext tables.
Back up your data first.
Resolution
Back up your data first.
Only attempt this if you are comfortable with database administration.
- Identify the problematic XML:
Identify the Project's ID:
select * from project;
Identify the Project's configurations (this may return quite a few results):
select * from propertytext where ID in (select ID from propertyentry where property_key = 'GREENHOPPER%XXXXX');
- With the list of results, check the XML data. Note that this may return a large list of results
- Once the problematic XML is found, update the entry with the proper format