Re: classloader error

Randall Wood <rhwood@...>
 

If `git bisect` is getting you to a commit where Jython 2.7.0 is replaced with Jython 2.7.1, please try replacing Jython 2.7.1 with 2.7.0 and see if that works (running from HEAD of master). If that does work, it suggests that Jython 2.7.0 included some code that we relied on that wasn’t expected.

From HEAD of master, I’m not able to reproduce these errors with JDK 11.0.4, but am able to reproduce them with JDK 1.8.0_222 (both AdoptOpenJDK on macOS 10.15).

Note however, that the problem is in Java itself, not in the JMRI code:
    [java]    at java.util.Properties.loadFromXML(Properties.java:881)
    [java]    at jmri.profile.ProfileManager.readActiveProfile(ProfileManager.java:293)

since the XML parsing code is called by java.util.Properties.loadFromXML (https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#loadFromXML-java.io.InputStream-)

(Unless we are (or are not) doing something to trigger a specific XML implementation that I’m not aware of, but should be.)

On Oct 18, 2019, at 6:32 AM, Dave Heap <dgheap@...> wrote:

All,

On 17 Oct 2019, at 1:09 PM, Pete Cressman <pete_cressman@...> wrote:

I upgraded to Java 1.8.0_231 and merged from the master.
After a clean build IO get this error upon launching PanelPro or DecoderPro:

java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

In a branch compiled before the above upgrade/merge, I can launch PanelPro or DecoderPro with no errors.

I'm getting a similar error with 'ant decoderpro' on my Mac on my local master up to date with origin master on a clean working tree. Tried Java 1.8.0_211, 1.8.0_221 and 1.8.0_231.

Git Bisect tells me:
27c1a9bed49c5ef8f9fa50a229c41bca7b5d3dd7 is the first bad commit
commit 27c1a9bed49c5ef8f9fa50a229c41bca7b5d3dd7
Author: Randall Wood <randall.h.wood@...>
Date:   Sat Sep 21 10:40:25 2019 -0400

   revert fa110c8a39

   fa110c8a39 demonstrated that there is a problem running Jython 2.7.1 on Windows with JMRI as is. The next step is to figure out what changed between 2.7.0 and 2.7.1 that this only fails on Windows.

:100644 100644 2c49b05d9e8debf6c0bf2f2f5e7347ff3ebfdcf5 25fa05285d2f22b117a0c8178de408769b003509 M    build.xml
:040000 040000 30822ca7c3d90e6ab354d594ec99659bb54f0e27 2cd42e51a12044bf017c66d69706e8f258ac914f M    lib

(Repeated bisect with 'ant real realclean' at each bisect. Same result.)

Typical log:
git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
Trains:jmri heap$ git log -1
commit 293f0e1654f74d3dcc0068ba6472888dee043050 (HEAD -> master, origin/master, origin/HEAD, bisect2)
Merge: 0dd46c9981 cfa1028a24
Author: Paul Bender <paul.bender@...>
Date:   Thu Oct 17 07:33:04 2019 -0700

   Merge pull request #7517 from pabender/master

   Some cleanup.
Trains:jmri heap$ ant realclean
Buildfile: /Users/heap/jmri/build.xml

clean:

clean:

realclean:

BUILD SUCCESSFUL
Total time: 0 seconds
Trains:jmri heap$ ant decoderpro
Buildfile: /Users/heap/jmri/build.xml

init:

copyfiles:
    [copy] Copying 17 files to /Users/heap/jmri/target/classes/resources
    [copy] Copying 1721 files to /Users/heap/jmri/target/classes

jjtree:

javacc:

update-template-code:
    [copy] Copying 1 file to /Users/heap/jmri/java/tmp

compile-generated-source:
   [javac] Compiling 134 source files to /Users/heap/jmri/target/classes
   [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'
   [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.NamedServiceProcessor' less than -source '1.8'
   [javac] 2 warnings
    [copy] Copying 1 file to /Users/heap/jmri/target/classes/jmri

compile:
   [javac] Compiling 4405 source files to /Users/heap/jmri/target/classes
   [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'
   [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.NamedServiceProcessor' less than -source '1.8'
   [javac] 2 warnings

debug:

decoderpro:

runtime-library-selection:
    [echo] arch.lib.path /Users/heap/jmri/lib/macosx/x86_64:/Users/heap/jmri/lib/macosx

-normal-jmri-application:
    [echo] Launch normally (no debugger support)
    [java] 2019-10-18 21:26:49,049 util.Log4JUtil                        INFO  - ****** JMRI log ******* [main]
    [java] 2019-10-18 21:26:50,808 util.Log4JUtil                        INFO  - This log is appended to file: /Users/heap/Library/Preferences/JMRI/log/messages.log [main]
    [java] 2019-10-18 21:26:50,810 util.Log4JUtil                        INFO  - This log is stored in file: /Users/heap/Library/Preferences/JMRI/log/session.log [main]
    [java] 2019-10-18 21:26:50,821 apps.AppsBase                         INFO  - DecoderPro version 4.17.5ish+heap+20191018T1024Z+R293f0e1654 starts under Java 1.8.0_231 on Mac OS X x86_64 v10.10.5 at Fri Oct 18 21:26:50 AEDT 2019 [main]
    [java] 2019-10-18 21:26:51,478 ptionhandler.UncaughtExceptionHandler ERROR - Uncaught Exception caught by jmri.util.exceptionhandler.UncaughtExceptionHandler [main]
    [java] java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    [java]    at java.lang.ClassLoader.defineClass1(Native Method)
    [java]    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    [java]    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    [java]    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    [java]    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    [java]    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    [java]    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    [java]    at java.security.AccessController.doPrivileged(Native Method)
    [java]    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    [java]    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    [java]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    [java]    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    [java]    at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    [java]    at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    [java]    at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    [java]    at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    [java]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    [java]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    [java]    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    [java]    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    [java]    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    [java]    at sun.util.xml.PlatformXmlPropertiesProvider.getLoadingDoc(PlatformXmlPropertiesProvider.java:106)
    [java]    at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:78)
    [java]    at java.util.Properties$XmlSupport.load(Properties.java:1201)
    [java]    at java.util.Properties.loadFromXML(Properties.java:881)
    [java]    at jmri.profile.ProfileManager.readActiveProfile(ProfileManager.java:293)
    [java]    at jmri.profile.ProfileManager.getStartingProfile(ProfileManager.java:906)
    [java]    at jmri.profile.ProfileManagerDialog.getStartingProfile(ProfileManagerDialog.java:318)
    [java]    at apps.gui3.Apps3.configureProfile(Apps3.java:335)
    [java]    at apps.AppsBase.<init>(AppsBase.java:92)
    [java]    at apps.gui3.Apps3.<init>(Apps3.java:93)
    [java]    at apps.gui3.dp3.DecoderPro3.<init>(DecoderPro3.java:27)
    [java]    at apps.gui3.dp3.DecoderPro3.main(DecoderPro3.java:96)
    [java] Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    [java]    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    [java]    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    [java]    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    [java]    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    [java]    ... 33 more
    [java] Java Result: 126

-debug-jmri-application:

-run-jmri-application:
    [echo] apps.gui3.dp3.DecoderPro3 finished with return code 126

-relaunch-jmri-application:

BUILD SUCCESSFUL
Total time: 2 minutes 9 seconds



Dave in Australia

Join jmri@jmri-developers.groups.io to automatically receive all group messages.