1

I tried the first example from the python documentation for SimpleXMLRPCServer.

It works perfectly fine in python, but when I try it using jython I get the following stacktrace:

Traceback (most recent call last):
  File "sampleclient.py", line 4, in <module>
    print s.pow(2,3)  # Returns 2**3 = 8
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1433, in _ServerProxy__request
    response = self.__transport.request(
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1324, in _parse_response
    p, u = self.getparser()
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1210, in getparser
    return getparser(use_datetime=self._use_datetime)
  File "/usr/share/jython/Lib/xmlrpclib.py", line 1023, in getparser
    parser = ExpatParser(target)
  File "/usr/share/jython/Lib/xmlrpclib.py", line 536, in __init__
    self._parser = parser = expat.ParserCreate(None, None)
  File "/usr/share/jython/Lib/xml/parsers/expat.py", line 63, in ParserCreate
    return XMLParser(encoding, namespace_separator)
  File "/usr/share/jython/Lib/xml/parsers/expat.py", line 91, in __init__
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser)
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
    at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:229)
    at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:220)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)

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

I'm much more experienced with python than java, so I'm not sure how to fix this. Is a dependency missing from my system or do I need to fiddle with classpaths?

EDIT: I re-tried this with the stand-alone versions from Jython's website, and they worked, so It seems there might be something broken with Ubuntu's installed version?

bj0
  • 7,893
  • 5
  • 38
  • 49

0 Answers0