XMLInputFactory Cast Error.

XMLInputFactory Cast Error.

book

Article ID: KB0089518

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:

When using the XMLInputFactory class in Java Code Activity

XMLInputFactory inputFactory = (XMLInputFactory) XMLInputFactory2.newInstance();

the following exception may be seen:

While executing [newInstance] encountered [java.lang.ClassCastException] : [com.tibco.xml.parsers.xmlfactories.XMLInputFactory cannot be cast to org.codehaus.stax.XMLInputFactory]


Symptoms:
com.tibco.xml.parsers.xmlfactories.XMLInputFactory cannot be cast to org.codehaus.stax.XMLInputFactory"
Cause:
Inputfactory should be set before using the inputfactory.

Issue/Introduction

XMLInputFactory Cast Error.

Resolution

Set the inputfactory before using.

System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");