Page 1 of 1
Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 8:21 am
by tony
I have moved to a new laptop and a fresh Oxygen 24.1 installation. I was previously using an Ant transformation scenario using the DITA4Publishers plugin to convert Word to DITA. When running the transformation in 24.1, I am getting the error:
java.lang.NoClassDefFoundError: net/sf/saxon/expr/XPathContext
Any ideas how to resolve this? Is it using the wrong Saxon version?
Re: Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 8:31 am
by Radu
Hi,
Oxygen 24.1 comes with a predefined "DOCX DITA" transformation scenario which should work, you can duplicate it and click the "Libraries" button to see what Java libraries it references.
I guess you use your own copy of the transformation scenario and if you do, you can edit it, click the Libraries button and add a reference to this new library path:
${oxygenHome}/lib/*saxon*10*.jar
As an alternative maybe you can use our free Batch Documents Converter add-on to convert Word to DITA:
https://www.oxygenxml.com/doc/versions/ ... addon.html
Regards,
Radu
Re: Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 8:56 am
by tony
Thanks for the reply, Radu.
I added the Saxon 10 libraries, and I now get a new error:
javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 16 errors detected.
which is very vague. This error appears for all Word docs that I try, including ones that transformed previously.
The standard DOCX transformation scenario works, but I need to use a style mapping file.
Any more ideas? Thanks in advance!
Re: Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 9:18 am
by Radu
Hi Tony,
Oxygen 24.1 comes bundled with the Saxon 10 XSLT processor libraries, previous Oxygen versions came with Saxon 9.
So maybe the XSLT processor is more strict when it comes to the processed stylesheets.
After the transformation fails there should be an "ANT [DOCX DITA...]" console tab view at the bottom of Oxygen showing more details about the encountered XSLT errors. Maybe you can find some relevant errors reported there, you can also paste part of the console output in a followup post if you want to give me more details.
Maybe you could also consider starting from Oxygen's pre-defined "DOCX DITA" transformation scenario and configure it to use your custom styles.
Regards,
Radu
Re: Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 9:25 am
by tony
Thanks Radu. Can you explain how I can customise the style mapping for the predefined DOCX DITA scenario? Is this predefined scenario the w2d plugin?
Re: Word2DITA transformationNoClassDefFoundError
Posted: Fri May 20, 2022 11:52 am
by Radu
Hi Tony,
That is a third party plugin which I do not have much experience using.
Looking at its documentation there is a "styleMapUri" parameter which can probably be set for this:
http://www.dita4publishers.org/docs/rep ... xygen.html
I assumed that as you already have a transformation scenario for this, you can edit it and look in the Parameters tab to see what values you have set there.
Regards,
Radu
Re: Word2DITA transformationNoClassDefFoundError
Posted: Mon May 23, 2022 10:45 am
by tony
Thanks for your help, Radu. I found the problem, which was that the order of the Libraries is important. When I created a new Scenario, the libraries were in the order:
<String>${oxygenHome}/lib/*saxon*10*.jar</String> <String>${oxygenHome}/lib/*saxon*9*.jar</String>
<String>${oxygenHome}/lib/*saxon*6*.jar</String>
When I added the missing Saxon 10 library to my "old" scenario's libraries, it was added to the bottom, so Saxon 10 appeared AFTER Saxon 9 and 6. When I changed the order, it all worked again. Now, it could well have been something else!! But I'm pretty confident the order was the issue.
Thanks again.
Tony