Forum Discussion

cc_mamir's avatar
cc_mamir
New Contributor
16 years ago

JDBC Error - [INVALID_CHARACTER_ERR: An invalid or illegal XML character is spe

Hi Guys,
when trying to run JDBC test step, I am getting "[INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. ]". Connection testing is ok "Connection Successfully Tested". The following is the error log, Please experts help to solve this issue.
"ERROR:org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
  org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
  at org.apache.xerces.dom.CoreDocumentImpl.createElement(Unknown Source)
  at com.eviware.soapui.support.xml.XmlUtils.addResultSetXmlPart(XmlUtils.java:1510)
  at com.eviware.soapui.support.xml.XmlUtils.createJdbcXmlResult(XmlUtils.java:1444)
  at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcResponse.(JdbcResponse.java:36)
  at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.createResponse(JdbcSubmit.java:348)
  at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.runQuery(JdbcSubmit.java:204)
  at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.run(JdbcSubmit.java:161)
  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
"

Thanks,
Amir

7 Replies

  • Hi Amir,

    you seem to have a column name in the result that isn't a valid xml element name, can you change this in your select statement?

    Also, could you let us know what this name is so we can fix it?

    regards!

    /Ole
    eviware.com
  • cc_mamir's avatar
    cc_mamir
    New Contributor
    Hi Ole,

    Thanks for your reply.

    Firstly I try to parameterize input in sql query in jdbc step, but unable.
    Secondly I try to paramterize input in  data sink step and there also unable to paramterize.
    like example


    insert into xyz_table values (${DataSource#Sno})

    but its not able to substitute value in the query and getting the error.


    Please help to solve this issue.

    Thanks and regards,
    Amir
  • BlackGaff's avatar
    BlackGaff
    New Contributor
    Greetings,

    I've created two JDBC requests and verified the connection is valid. Each request uses the same connection information, but has a different SQL query. When I run the test case, one JDBC request receives the "invalid or illegal XML character" error but the other doesn't. I've verified both are valid SQL statements using TOAD, and neither request has paramaterized data. Requests and error message are below:

    Request that does NOT yield the error:
    SELECT UNIQUE
    a.column1 as column1,
    a.column2 as column2,
    b.column1 as "B column1",
    b.column2 as "B column2"

    FROM table1 a
    left outer join table2 b on b.column3 = a.column3 and b.column4 = 71

    WHERE
    b.column2 LIKE '123%45%6789'

    order by a.column2



    Request that does yield the error:
    SELECT UNIQUE
    a.column1 as column1,
    a.column2 as column2,
    c.column1 as "B column1",
    c.column2 as "B column2",
    c.column3 as "B column3"

    FROM table1 a
    left outer join table3 c on c.column3 = a.column3

    WHERE
    a.column1 = '123456'

    order by a.column2


    Error:
    Fri Jul 09 08:30:45 MDT 2010:ERROR:org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
    org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
    at org.apache.xerces.dom.CoreDocumentImpl.createElement(Unknown Source)
    at com.eviware.soapui.support.xml.XmlUtils.addResultSetXmlPart(XmlUtils.java:1510)
    at com.eviware.soapui.support.xml.XmlUtils.createJdbcXmlResult(XmlUtils.java:1444)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcResponse.<init>(JdbcResponse.java:36)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.createResponse(JdbcSubmit.java:348)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.runQuery(JdbcSubmit.java:204)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.run(JdbcSubmit.java:161)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


    Any thoughts?

    SoapUI Pro, ver 3.5.1
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Blackgaff-

    The error is occurring when the response is being assembled, which suggests to me that there is something in the result set that it doesn't like. Have you looked at the results in Toad to see if there are any characters that might cause an issue?
  • BlackGaff's avatar
    BlackGaff
    New Contributor
    Thanks for the quick reply - you're right, it is the response, which was including some special characters like a hyphen "-"

    If i modify the request to only be
       a.column1 as column1,
    a.column2 as column2,
    , I do not get the error.

    Is there a way to disable SoapUI from rendering results in XML format?
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Not that I know of, but a hyphen shouldn't be a problem... could it be the column name that is being created is not a valid XML element name?
  • Hi,
    I've found out the solution - call it a bug

    The problem is in response when xml is build. If you use a query where the name of return column is not specified, then it is null (I just assume) and error is created. If you give a name to this column using "as" everything is created succesfully. I had this problem with aggregation functions like max, min, etc.

    I hope it helped.