Use of ampersand (&) causes XML parsing failure in JBoss EAP

Solution Verified - Updated -

Issue

A field with a value containing ampersands (e.g. <password>some&data&here</password>) in JBoss XML configuration files results in a failure during startup/application deployment.

EAP 5

... org.xml.sax.SAXException: The entity name must immediately follow the '&' in the entity reference. @ ...
    at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.fatalError(SaxJBossXBParser.java:432)
    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)

EAP 7

... com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '&' (code 38); expected a semi-colon after the reference for entity 'data' at [row,col {unknown-source}]: [219,44]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:653)
    ...
    at com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:699)
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.getElementText(XMLExtendedStreamReaderImpl.java:144)
    at org.jboss.as.connector.util.AbstractParser.rawElementText(AbstractParser.java:61)
    ...
    at org.jboss.as.connector.subsystems.datasources.DsParser.parseDataSources(DsParser.java:229)
    at org.jboss.as.connector.subsystems.datasources.DsParser.parse(DsParser.java:189)
    ...

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7
    • 6
    • 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content