# SAX2 driver class org.apache.xerces.parsers.SAXParser

**URL:** <https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620>\
**Category:** Ignition\
**Created:** [May 31, 2013, 5:32pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620 "2013-05-31T17:32:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bokechal](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bokechal](https://forum.inductiveautomation.com/u/bokechal)\
**Post date:** [May 31, 2013, 5:32pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/1 "2013-05-31T17:32:19Z")

</div>

I hope someone has come across this problem before and can help me here.  
I got this error when execute a script embedded into a button. Script is doing a http request call and getting return back as XML. I then use ElementTree to parse that XML document into a string and put it in our database.

It works ok when I do this in the designer preview mode until I want to try to launch the client and test, the error message popped up

I saw another discussion here back in Oct’12 quite similar to this. I thought that the latest gateway I have should already handle that but looks like it’s not the case here.

Can anyone please shed some light here?  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/61a9e7f19a05b26db09753991ae22a933c75aacc.png)  
  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/212eaef9fa1bd442a54c971b0a24c15cbbae61c3.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 31, 2013, 6:17pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/2 "2013-05-31T18:17:08Z")

</div>

Can you show us your code?

I think what this means is that org.apache.xerces.parsers.SAXParser is on the designer’s classpath for whatever reason, but isn’t on the client’s classpath… the question is whether that’s correct or not.

---

<div class="post-metadata">

**Author:** ![bokechal](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bokechal](https://forum.inductiveautomation.com/u/bokechal)\
**Post date:** [May 31, 2013, 6:43pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/3 "2013-05-31T18:43:45Z")

</div>

Here it is  
[batchquery1.py](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/3afbfa22654c7ac6ba967c9a19422a289fe39339.py) (2.65 KB)

---

<div class="post-metadata">

**Author:** ![bokechal](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bokechal](https://forum.inductiveautomation.com/u/bokechal)\
**Post date:** [June 3, 2013, 10:43pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/4 "2013-06-03T22:43:40Z")

</div>

If this problem is likely to be the client’s classpath, can you tell me how to add that?

---

<div class="post-metadata">

**Author:** ![heikkihe](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@heikkihe](https://forum.inductiveautomation.com/u/heikkihe)\
**Post date:** [September 9, 2013, 6:39am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/5 "2013-09-09T06:39:41Z")

</div>

Hi!

I have exactly the same problem. I use Python ElementTree to parse XML files and everything works fine in designer but when I launch the project e.g. to staging mode, python cannot find ElementTree module.

I’ve verified this operation on two different computers, one with with windows xp & java 6 and the other with windows 7 & java 7. Both computers had Ignition 7.6.2 (b2368) installed.

Does anybody know how to solve this problem?

regards  
-Heikki

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 9, 2013, 5:01pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/6 "2013-09-09T17:01:21Z")

</div>

Hi there, yes, I know how to solve this problem 😃

Add this code to the top of your script and it will work:

```auto
from org.python.core import imp
from java.lang import Thread
Thread.currentThread().setContextClassLoader(imp.getParentClassLoader())
```

Here is an explanation of the problem and solution:

This is a Classloader problem.

The expat.py module tries to load “org.python.apache.xerces.parsers.SAXParser” before it tries to load “org.apache.xerces.parsers.SAXParser” and fails.

Here’s the code I am talking about:

```auto
# Xerces
_mangled_xerces_parser_name = "org.python.apache.xerces.parsers.SAXParser"
_xerces_parser_name = "org.apache.xerces.parsers.SAXParser"
try:
    self._reader = XMLReaderFactory.createXMLReader(_mangled_xerces_parser_name)
except:
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
```

But both the client and designer can import “org.python.apache.xerces.parsers.SAXParser” just fine.

The problem is that the XMLReaderFactory.createXMLReader method in expat.py tries to load “org.python.apache.xerces.parsers.SAXParser” dynamically but looks in the wrong classloaders.

The reason this works in the designer is because in the designer the context classloader is set to a classloader that works. In the client the context classloader is set to null.

So you can get this to work in the client by setting the context classloader to the appropriate classloader.

---

<div class="post-metadata">

**Author:** ![heikkihe](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@heikkihe](https://forum.inductiveautomation.com/u/heikkihe)\
**Post date:** [September 10, 2013, 4:58am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/7 "2013-09-10T04:58:00Z")

</div>

Hi!

Thank you very much, now the parsing works fine also in the client.

regards  
-Heikki

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [October 23, 2014, 7:59am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/8 "2014-10-23T07:59:00Z")

</div>

I know this post is a year old, but it solved a problem I had today.

This is such a great resource

Thanks Nick and heikkihe

---

<div class="post-metadata">

**Author:** ![bmyers](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bmyers](https://forum.inductiveautomation.com/u/bmyers)\
**Post date:** [September 15, 2017, 2:33pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/9 "2017-09-15T14:33:28Z")

</div>

Fixed the same issues for me 3 years later.

---

<div class="post-metadata">

**Author:** ![arthur.dent](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@arthur.dent](https://forum.inductiveautomation.com/u/arthur.dent)\
**Post date:** [February 14, 2019, 12:35am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/10 "2019-02-14T00:35:11Z")

</div>

Yep, same issue and successful fix here!

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [February 3, 2021, 10:07pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/11 "2021-02-03T22:07:15Z")

</div>

Many years later… this still seems to be a bug in 8.1.1. Should I continue to use the workaround?

```auto
Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43) 
[OpenJDK 64-Bit Server VM (Azul Systems, Inc.)] on java11.0.7

>>> oc.submit()
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<module:opcenter>", line 501, in submit
  File "<module:opcenter>", line 231, in submit
  File "<module:opcenter>", line 263, in xml
  File "<module:opcenter>", line 291, in dict
  File "<module:opcenter>", line 291, in dict
  File "C:\...\C0\pylib\xmltodict.py", line 295, in parse
    parser = expat.ParserCreate(
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 59, in ParserCreate
    return XMLParser(encoding, namespace_separator)
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 91, in __init__
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

org.xml.sax.SAXException: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at org.python.core.Py.JavaError(Py.java:552)

	at org.python.core.Py.JavaError(Py.java:543)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:206)

	at org.python.core.PyObject. __call__ (PyObject.java:480)

	at org.python.core.PyObject. __call__ (PyObject.java:484)

	at xml.parsers.expat$py. __init__ $3(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xml/parsers/expat.py:139)

	at xml.parsers.expat$py.call_function(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xml/parsers/expat.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:199)

	at org.python.core.PyFunction. __call__ (PyFunction.java:482)

	at org.python.core.PyMethod.instancemethod ___call__ (PyMethod.java:237)

	at org.python.core.PyMethod. __call__ (PyMethod.java:228)

	at org.python.core.PyMethod. __call__ (PyMethod.java:223)

	at org.python.core.Deriveds.dispatch __init__ (Deriveds.java:19)

	at org.python.core.PyObjectDerived.dispatch __init__ (PyObjectDerived.java:1112)

	at org.python.core.PyType.type ___call__ (PyType.java:1880)

	at org.python.core.PyType. __call__ (PyType.java:1863)

	at org.python.core.PyObject. __call__ (PyObject.java:497)

	at org.python.core.PyObject. __call__ (PyObject.java:501)

	at xml.parsers.expat$py.ParserCreate$1(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xml/parsers/expat.py:59)

	at xml.parsers.expat$py.call_function(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xml/parsers/expat.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:154)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at xmltodict$py.parse$12(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xmltodict.py:312)

	at xmltodict$py.call_function(C:/Users/rmclaughlin/.ignition/cache/gwnhigndev.allegro.msad_443/C0/pylib/xmltodict.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:132)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.pycode._pyx73.dict$17(<module:opcenter>:293)

	at org.python.pycode._pyx73.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyFunction. __call__ (PyFunction.java:408)

	at org.python.core.PyProperty.property ___get__ (PyProperty.java:82)

	at org.python.core.PyProperty. __get__ (PyProperty.java:71)

	at org.python.core.PyObject.object ___findattr__ (PyObject.java:3848)

	at org.python.core.PyObject.object ___getattribute__ (PyObject.java:3832)

	at org.python.core.PyObject$object ___getattribute___ exposer. __call__ (Unknown Source)

	at org.python.core.Deriveds. __findattr_ex__ (Deriveds.java:59)

	at org.python.core.PyObjectDerived. __findattr_ex__ (PyObjectDerived.java:1036)

	at org.python.core.PyObject. __getattr__ (PyObject.java:1025)

	at org.python.pycode._pyx73.xml$15(<module:opcenter>:282)

	at org.python.pycode._pyx73.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:154)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at org.python.core.PyFunction. __call__ (PyFunction.java:418)

	at org.python.core.PyProperty.property ___set__ (PyProperty.java:95)

	at org.python.core.PyProperty. __set__ (PyProperty.java:87)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3884)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3874)

	at org.python.core.PyObject$object ___setattr___ exposer. __call__ (Unknown Source)

	at org.python.core.PyObjectDerived. __setattr__ (PyObjectDerived.java:1043)

	at org.python.pycode._pyx73.submit$10(<module:opcenter>:238)

	at org.python.pycode._pyx73.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyMethod. __call__ (PyMethod.java:126)

	at org.python.pycode._pyx73.submit$37(<module:opcenter>:512)

	at org.python.pycode._pyx73.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyMethod. __call__ (PyMethod.java:126)

	at org.python.pycode._pyx75.f$0(<input>:1)

	at org.python.pycode._pyx75.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1614)

	at org.python.core.Py.exec(Py.java:1658)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)

	... 83 more

Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)

	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)

	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)

	... 90 more

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<module:opcenter>", line 501, in submit
  File "<module:opcenter>", line 231, in submit
  File "<module:opcenter>", line 263, in xml
  File "<module:opcenter>", line 291, in dict
  File "<module:opcenter>", line 291, in dict
  File "C:\...\C0\pylib\xmltodict.py", line 295, in parse
    parser = expat.ParserCreate(
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 59, in ParserCreate
    return XMLParser(encoding, namespace_separator)
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 91, in __init__
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

org.xml.sax.SAXException: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
>>> 

```

PS - It is very intermittent… maybe 1/100 executions of the same code. Annoying to debug none the less

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 3, 2021, 11:24pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/12 "2021-02-03T23:24:09Z")

</div>

This is very likely an internal Jython bug; without consistent reproduction it would be very hard for us to fix.

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [February 4, 2021, 3:04am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/13 "2021-02-04T03:04:33Z")

</div>

Didn’t think of searching jython bugs…

Looks like this one… [Issue 2693: SAXParser, classloader and dynamically loading jython - Jython tracker](https://bugs.jython.org/issue2693)

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [February 4, 2021, 12:29pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/14 "2021-02-04T12:29:05Z")

</div>

I've had a conversation with IA Support about this error recently and they mentioned there are 3 current bug tickets related to this error. They suggested looking for a workaround since one of those tickets date back to 7.7 days.

I've used SAXParser in previous 7.8 and 7.9 gateways without issues and since version 8, it just about fails every time the script runs in the Client but works in the Designer.

Nick's workaround is great.  
I found this link yesterday for another work around:

> [@XML Parsing Failing Every 10 Runs of Code](http://forum.inductiveautomation.com/t/xml-parsing-failing-every-10-runs-of-code/21838/3):
>
> Consider using the Java native XML handling, which yields an XML Document with standard DOM methods. [https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Document.html](https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Document.html) You might find my [shared script module](https://www.automation-pros.com/ignition/xml.py) a start, used like so: dom = shared.xml.strToDoc(oxml)

---

<div class="post-metadata">

**Author:** ![TK070](https://avatars.discourse-cdn.com/v4/letter/t/eb9ed0/32.png) [@TK070](https://forum.inductiveautomation.com/u/TK070)\
**Post date:** [May 27, 2021, 4:47am UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/15 "2021-05-27T04:47:56Z")

</div>

This still seems to work for the same bug in 8.1.5.  
Thanks @nmudge

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 27, 2021, 1:45pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/16 "2021-05-27T13:45:10Z")

</div>

The workaround should no longer be necessary in 8.1.5; we made a change in how the Jython interpreter is loaded that should fix this ‘at the source’:  
[https://inductiveautomation.com/downloads/releasenotes/8.1.5#16892](https://inductiveautomation.com/downloads/releasenotes/8.1.5#16892)

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [May 27, 2021, 3:54pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/17 "2021-05-27T15:54:58Z")

</div>

So, should this be fixed in all scopes now? I’ll test some more next week for sure when we update to 8.1.6.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 27, 2021, 4:03pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/18 "2021-05-27T16:03:28Z")

</div>

So far as we’re aware, anyways… 🤞

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [July 30, 2021, 1:04pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/19 "2021-07-30T13:04:30Z")

</div>

Hate to be the bearer of bad news… in 8.1.6, still occurring, in the designer script console, seemingly random, but fairly consistent every dozen or so calls, I get the following… Good news, I have not noticed any issues in Perspective sessions after removing the Thread/Classloader snippet.

```auto
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 4, in <module>
  File "<module:opcenter>", line 1832, in __init__
  File "<module:opcenter>", line 1846, in cdo
  File "<module:opcenter>", line 430, in cdo_metadata
  File "<module:opcenter>", line 361, in submit_and_return
  File "<module:opcenter>", line 311, in submit
  File "<module:opcenter>", line 591, in xml
  File "<module:opcenter>", line 652, in dict
  File "<module:opcenter>", line 652, in dict
  File "C:\...\C0\pylib\xmltodict.py", line 295, in parse
    parser = expat.ParserCreate(
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 59, in ParserCreate
    return XMLParser(encoding, namespace_separator)
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 91, in __init__
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

org.xml.sax.SAXException: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at org.python.core.Py.JavaError(Py.java:552)

	at org.python.core.Py.JavaError(Py.java:543)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:206)

	at org.python.core.PyObject. __call__ (PyObject.java:480)

	at org.python.core.PyObject. __call__ (PyObject.java:484)

	at xml.parsers.expat$py. __init__ $3(C:/.../C0/pylib/xml/parsers/expat.py:139)

	at xml.parsers.expat$py.call_function(C:/.../C0/pylib/xml/parsers/expat.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:199)

	at org.python.core.PyFunction. __call__ (PyFunction.java:482)

	at org.python.core.PyMethod.instancemethod ___call__ (PyMethod.java:237)

	at org.python.core.PyMethod. __call__ (PyMethod.java:228)

	at org.python.core.PyMethod. __call__ (PyMethod.java:223)

	at org.python.core.Deriveds.dispatch __init__ (Deriveds.java:19)

	at org.python.core.PyObjectDerived.dispatch __init__ (PyObjectDerived.java:1112)

	at org.python.core.PyType.type ___call__ (PyType.java:1880)

	at org.python.core.PyType. __call__ (PyType.java:1863)

	at org.python.core.PyObject. __call__ (PyObject.java:497)

	at org.python.core.PyObject. __call__ (PyObject.java:501)

	at xml.parsers.expat$py.ParserCreate$1(C:/.../C0/pylib/xml/parsers/expat.py:59)

	at xml.parsers.expat$py.call_function(C:/.../C0/pylib/xml/parsers/expat.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:154)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at xmltodict$py.parse$12(C:/.../C0/pylib/xmltodict.py:312)

	at xmltodict$py.call_function(C:/.../C0/pylib/xmltodict.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyFunction.function ___call__ (PyFunction.java:471)

	at org.python.core.PyFunction. __call__ (PyFunction.java:466)

	at org.python.pycode._pyx236.dict$29(<module:opcenter>:654)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyFunction. __call__ (PyFunction.java:408)

	at org.python.core.PyProperty.property ___get__ (PyProperty.java:82)

	at org.python.core.PyProperty. __get__ (PyProperty.java:71)

	at org.python.core.PyObject.object ___findattr__ (PyObject.java:3848)

	at org.python.core.PyObject.object ___getattribute__ (PyObject.java:3832)

	at org.python.core.PyObject$object ___getattribute___ exposer. __call__ (Unknown Source)

	at org.python.core.Deriveds. __findattr_ex__ (Deriveds.java:59)

	at org.python.core.PyObjectDerived. __findattr_ex__ (PyObjectDerived.java:1036)

	at org.python.core.PyObject. __getattr__ (PyObject.java:1025)

	at org.python.pycode._pyx236.xml$27(<module:opcenter>:639)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:154)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at org.python.core.PyFunction. __call__ (PyFunction.java:418)

	at org.python.core.PyProperty.property ___set__ (PyProperty.java:95)

	at org.python.core.PyProperty. __set__ (PyProperty.java:87)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3884)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3874)

	at org.python.core.PyObject$object ___setattr___ exposer. __call__ (Unknown Source)

	at org.python.core.PyObjectDerived. __setattr__ (PyObjectDerived.java:1043)

	at org.python.pycode._pyx236.submit$11(<module:opcenter>:356)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyMethod. __call__ (PyMethod.java:126)

	at org.python.pycode._pyx236.submit_and_return$12(<module:opcenter>:368)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:139)

	at org.python.core.PyFunction. __call__ (PyFunction.java:413)

	at org.python.core.PyMethod. __call__ (PyMethod.java:126)

	at org.python.pycode._pyx236.cdo_metadata$14(<module:opcenter>:465)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:146)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at org.python.core.PyMethod. __call__ (PyMethod.java:141)

	at org.python.pycode._pyx236.cdo$101(<module:opcenter>:1852)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:154)

	at org.python.core.PyFunction. __call__ (PyFunction.java:423)

	at org.python.core.PyFunction. __call__ (PyFunction.java:418)

	at org.python.core.PyProperty.property ___set__ (PyProperty.java:95)

	at org.python.core.PyProperty. __set__ (PyProperty.java:87)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3884)

	at org.python.core.PyObject.object ___setattr__ (PyObject.java:3874)

	at org.python.core.PyObject$object ___setattr___ exposer. __call__ (Unknown Source)

	at org.python.core.PyObjectDerived. __setattr__ (PyObjectDerived.java:1043)

	at org.python.pycode._pyx236. __init__ $99(<module:opcenter>:1832)

	at org.python.pycode._pyx236.call_function(<module:opcenter>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

	at org.python.core.PyBaseCode.call(PyBaseCode.java:199)

	at org.python.core.PyFunction. __call__ (PyFunction.java:482)

	at org.python.core.PyMethod.instancemethod ___call__ (PyMethod.java:237)

	at org.python.core.PyMethod. __call__ (PyMethod.java:228)

	at org.python.core.PyMethod. __call__ (PyMethod.java:223)

	at org.python.core.Deriveds.dispatch __init__ (Deriveds.java:19)

	at org.python.core.PyObjectDerived.dispatch __init__ (PyObjectDerived.java:1112)

	at org.python.core.PyType.type ___call__ (PyType.java:1880)

	at org.python.core.PyType. __call__ (PyType.java:1863)

	at org.python.core.PyObject. __call__ (PyObject.java:480)

	at org.python.core.PyObject. __call__ (PyObject.java:484)

	at org.python.pycode._pyx238.f$0(<input>:4)

	at org.python.pycode._pyx238.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1614)

	at org.python.core.Py.exec(Py.java:1658)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)

	... 117 more

Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)

	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)

	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)

	... 124 more

Traceback (most recent call last):
  File "<input>", line 4, in <module>
  File "<module:opcenter>", line 1832, in __init__
  File "<module:opcenter>", line 1846, in cdo
  File "<module:opcenter>", line 430, in cdo_metadata
  File "<module:opcenter>", line 361, in submit_and_return
  File "<module:opcenter>", line 311, in submit
  File "<module:opcenter>", line 591, in xml
  File "<module:opcenter>", line 652, in dict
  File "<module:opcenter>", line 652, in dict
  File "C:\...\C0\pylib\xmltodict.py", line 295, in parse
    parser = expat.ParserCreate(
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 59, in ParserCreate
    return XMLParser(encoding, namespace_separator)
  File "C:\...\C0\pylib\xml\parsers\expat.py", line 91, in __init__
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)

	at java.xml/org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

org.xml.sax.SAXException: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 30, 2021, 3:15pm UTC](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620/20 "2021-07-30T15:15:25Z")

</div>

Interesting. Can you try boiling that replication down a little? Is it _just_ the script console - you can’t repeat in Vision, for instance? Does a minimal SSCCE like this do it (I can’t replicate it, so I’m trying to isolate the missing factor)?

```auto
import xml.etree.ElementTree as ET

ET.fromstring(system.file.readFileAsString("C:\Users\pgriffith\Downloads\simple_script_sfc.xml"))

```

[Next page](https://forum.inductiveautomation.com/t/sax2-driver-class-org-apache-xerces-parsers-saxparser/6620.md?page=2)
