The XML content could not be parsed
Problem
After an upgrade some pages may not display correctly, and you will see errors in the atlassian-confluence.log
:
ERROR [http-8090-7] [content.render.xhtml.DefaultRenderer] render Error rendering content for view: The XML content could not be parsed. There is a problem at line 55, column 72. Parser message: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [55,72]
-- url: /pages/viewpage.action | page: 69833540 | userName: craigcm | action: viewpage
com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 55, column 72. Parser message: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [55,72]
at com.atlassian.confluence.content.render.xhtml.StaxUtils.convertToXhtmlException(StaxUtils.java:303)
at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:49)
at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:41)
at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:53)
at com.atlassian.confluence.content.render.xhtml.DefaultRenderer.render(DefaultRenderer.java:80)
at com.atlassian.confluence.content.render.xhtml.DefaultRenderer.render(DefaultRenderer.java:68)
...
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [55,72]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.StreamScanner.parseFullName(StreamScanner.java:1859)
at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:1985)
at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1496)
at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4681)
at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3703)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1023)
at com.ctc.wstx.evt.WstxEventReader.peek(WstxEventReader.java:306)
at com.ctc.wstx.evt.FilteredEventReader.peek(FilteredEventReader.java:120)
at com.ctc.wstx.evt.FilteredEventReader.hasNext(FilteredEventReader.java:70)
at com.atlassian.confluence.content.render.xhtml.XmlFragmentBodyEventReader.hasNext(XmlFragmentBodyEventReader.java:38)
at com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader.hasNext(ForwardingXmlEventReader.java:26)
at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transform(DefaultFragmentTransformer.java:88)
at com.atlassian.confluence.content.render.xhtml.storage.StorageXhtmlTransformer.transform(StorageXhtmlTransformer.java:43)
... 230 more
Diagnosis
This can happen if an upgrade task failed. There is a task that adds a column 'bodytypeid' to the 'bodycontent' table, and then sets the value for all wiki markup pages to 0. Another upgrade task then determines those that are still at 0, and attempts to migrate them to XHTML - the new storage format. If this value is null, the above error will occur.
To determine if this is the problem in your case, run this query against your database:
select * from BODYCONTENT
WHERE
contentid IN (
SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ('PAGE','COMMENT','BLOGPOST')
) AND
bodytypeid IS NULL;
If this returns any values, follow the steps below to resolve the issue.
Resolution
- Stop Confluence
- Execute this statement against the database, to set the value to 0, for all unmigrated content where the value is null
UPDATE BODYCONTENT SET bodytypeid = 0 WHERE contentid IN ( SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ('PAGE','COMMENT','BLOGPOST') ) AND bodytypeid IS NULL;
- Restart Confluence, and the upgrade tasks should run and migrate your data across to the new storage format (XHTML).
- To re-run the migration manually after the restart, follow the instructions here.