javapythonpython-3.xjpypempxj

Converting MPP files to MS XML format in Python using MPXJ


I am trying to convert MPP file to MS XML format using MPXJ library and Jpype

def convert(inputFile, outputFile):
   reader = ProjectReaderUtility.getProjectReader(inputFile)
   project = ProjectFile()
   project = reader.read(inputFile)
   writer = ProjectWriter
   writer = ProjectWriterUtility.getProjectWriter(outputFile)
   writer.write(project, outputFile)

This works fine if I try to convert to json format. However, there is always an error related to xml file. I get an error related to java xml library

java.io.IOException: java.io.IOException: javax.xml.bind.JAXBException: 
Implementation of JAXB-API has not been found on module path or classpath.
 with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]

Would anyone be able to assist in this issue. I am using Python 3.8 with jdk-15.0.2


Solution

  • Well it was a wrong dependency as inspired by Jon Illes response. I was using jaxb-api which isn't the correct dependency. After checking the list of dependency, I learnt that the correct package required is jaxb-runtime. After downloading it the script works.

    Thanks Jon for the prompt response and directing to the solution