I have been trying to use the latest jython beta release, and I have spent all day trying to work out why I can't use ant, javadoc, or any Java classes that make webservice calls. I keep getting classloader errors to do with xerces, eg "java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found". I have this class on my classpath, it's in xercesImpl.jar, which is included in the ant 1.7.1 distribution. If I take jython.jar off my classpath, ant and javadoc and stuff seem much happier.

It looks to me like what I am seeing is very similar to this bug:


Something in jython.jar is getting in the way of xerces. However, if I read this bug correctly, it was fixed in the beta 2 release. I am using the latest, beta 3 release. I thought I might do better with the absolute latest code, so I followed the instructions on http://wiki.python.org/jython/JythonDeveloperGuide and built the latest version. The regrtest ant target tells me all the tests pass. Now I have a jar called jython-dev.jar. I renamed it jython.jar and replaced my broken version with this new version in my jython installation. Now of course it doesn't run at all (see stack trace below).

So anyway, I find myself shaving a yak when all I want to do is write a small jython script to do some file filtering and call a java webservice. Can anyone help?


Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/CharStream
        at org.python.core.imp.compileSource(imp.java:267)
        at org.python.core.imp.createFromSource(imp.java:282)
        at org.python.core.imp.loadFromSource(imp.java:511)
        at org.python.core.imp.find_module(imp.java:410)
        at org.python.core.imp.import_next(imp.java:617)
        at org.python.core.imp.import_first(imp.java:638)
        at org.python.core.imp.load(imp.java:546)
        at org.python.core.util.FileUtil.isatty(FileUtil.java:71)
        at org.python.core.io.StreamIO.isatty(StreamIO.java:221)
        at org.python.core.io.BufferedIOMixin.isatty(BufferedIOMixin.java:90)
        at org.python.core.io.TextIOBase.isatty(TextIOBase.java:175)
        at org.python.core.PyFile.file_isatty(PyFile.java:482)
        at org.python.core.PyFile.isatty(PyFile.java:477)
        at org.python.util.jython.run(jython.java:151)
        at org.python.util.jython.main(jython.java:117)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.CharStream
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 15 more