Bug #6024
closedjava.lang.NoClassDefFoundError: org/jdom2/Document
100%
Description
We are running tests to switch from Saxon-EE 11.5 to 12.2. When starting a transformation via the command line, we now get the following error message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom2/Document
at net.sf.saxon.option.jdom2.JDOM2ObjectModel.isRecognizedNodeClass(JDOM2ObjectModel.java:159)
at net.sf.saxon.option.jdom2.JDOM2ObjectModel.getJPConverter(JDOM2ObjectModel.java:118)
at net.sf.saxon.expr.JPConverter.allocate(JPConverter.java:207)
at com.saxonica.expr.JavaExtensionFunctionCall.typeCheck(JavaExtensionFunctionCall.java:256)
at net.sf.saxon.style.StyleElement.typeCheck(StyleElement.java:1556)
at net.sf.saxon.style.XSLSequence.validate(XSLSequence.java:94)
at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1736)
at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1769)
at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1740)
at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(PrincipalStylesheetModule.java:398)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:290)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:254)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:113)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:971)
at net.sf.saxon.Transform.doTransform(Transform.java:777)
at net.sf.saxon.Transform.main(Transform.java:83)
Caused by: java.lang.ClassNotFoundException: org.jdom2.Document
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more
whereas with version 11.5 this went smoothly. Does something need to be adjusted or have we overlooked something?
Files
Updated by Martin Honnen over 1 year ago
Sounds a bit like https://saxonica.plan.io/issues/5920 but that is supposed to have been fixed in 12.1., I think
Updated by Johan Gheys over 1 year ago
- File command-line-6024.zip command-line-6024.zip added
Added a simple test case. Importing a stylesheet with references to java classes apparently still causes problems in 12.2.
Updated by Norm Tovey-Walsh over 1 year ago
Bug #6024: java.lang.NoClassDefFoundError: org/jdom2/Document open
- Author: Johan Gheys
- Status: New
- Priority: Normal
- Sprint/Milestone: 12.2
- Start date: 2023-05-09
We are running tests to switch from Saxon-EE 11.5 to 12.2. When starting a transformation via
the command line, we now get the following error message:
I hope this isn’t a silly question, but are you sure the JDOM2 classes
are on your classpath? They aren’t shipped as part of Saxon.
Be seeing you,
norm
--
Norm Tovey-Walsh
Saxonica
Updated by Johan Gheys over 1 year ago
No, the JDOM2 classes are not on the classpath (see attached files) because we don't want to use them. As the documentation states: "To use SaxonJ with DOM, you do not need any extra code on your classpath". This worked correctly in 11.5.
Updated by Norm Tovey-Walsh over 1 year ago
Sorry. I misunderstood the context. I agree, it does look like #5920 resurfacing.
Updated by Michael Kay over 1 year ago
It seems that the fix for #5920 added catch (Exception e)
in a couple of places. However, java.lang.NoClassDefFoundError
is not an Exception
(it's an Error
), so it isn't being caught.
It feels like the fix is to catch Throwable
. The real problem here is testing; we don't have a good mechanism for running tests with a non-standard classpath.
Updated by Michael Kay over 1 year ago
- Category set to Saxon extensions
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to branch 12, trunk added
- Fix Committed on Branch 12, trunk added
- Platforms Java added
I revised the patch to catch Throwable
, did a new build, and ran the test from the command line without any JDOM/DOM4J etc classes on the classpath and it ran correctly.
Updated by Johan Gheys over 1 year ago
Every time, we are impressed by your speed of intervention! Thank you Michael.
Updated by Norm Tovey-Walsh over 1 year ago
I'll create a build/release task to configure tests with a different classpath. That's not too hard to do.
Updated by O'Neil Delpratt over 1 year ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.3 added
Bug fix applied in the Saxon 12.3 maintenance release.
Updated by Ashok Kumar NV 3 months ago
Updated by Ashok Kumar NV 3 months ago
I am not finding https://mvnrepository.com/artifact/com.saxonica/Saxon-EE 12.3 version in maven repository, I am missing anything?
Updated by Michael Kay 3 months ago
Ashok, if you have a question, please raise a new issue, rather than adding comments to an issue that was closed a year ago, and is probably unrelated.
Please register to edit this issue