Query on PXF table failed with error "Unexpected character" when some special character in the xml file
search cancel

Query on PXF table failed with error "Unexpected character" when some special character in the xml file

book

Article ID: 296369

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

When working with PXF, the query might fail with an error like:
ERROR: remote component error (500) from '127.0.0.1:5888'...
Unable to read configuration for server SQLServer from 
<PATH_TO_PXF_CONF>/servers/<Server_name> (libchurl.c:985) (seg0 slicel xxx.xxx.xxx.xxx:xxxx 
pid=74260) (libchurl.c:985)

The PXF log (located in $PXF_CONF/logs) on the segment host will give us more detail:
java.lang.RuntimeException: Unable to read configuration for server SQLServer from /usr/local/greenplum-db/pxf_conf/servers/SQLServer
...
Caused by: [com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '2' (code 50) (expected a name start character)at [row,col,system-id]: [20,22,"file:/usr/local/greenplum-db/pxf_conf/servers/SQLServer/jdbc-site.xml] 
at [row,col,system-id]: [20,22,"file:/usr/local/greenplum-db/pxf_conf/servers/SQLServer/jdbc-site.xml] 
...


Environment

Product Version: 6.9

Resolution

Please check the XML file which reported with the error. To verify the syntax of the XML file, we can use "xmllint" utility:
# xmllint --format jdbc-site.xml

In this case, we found this line has an error:
$ xmllint --format jdbc-site.xml
jdbc-site.xml:20: parser error : xmlParseEntityRef: no name
        <value>matt&2020</value>

It is because the "&" mark can not be recognized by XML file, to fix this, we need to replace the "&" with the string "&amp;"
        <value>matt&amp;2020</value>

Refer to this link for more detail: [LINK]

Also, this is the link for the list of special character in XML: [LINK]