#22183 closed defect (fixed)
NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.actions.SessionSaveAction
Reported by: | anonymous | Owned by: | anonymous |
---|---|---|---|
Priority: | major | Milestone: | 22.09 |
Component: | Core | Version: | |
Keywords: | template_report | Cc: | michel.lethiec@…, OMNIBUS, nelson.canhoto92@…, Klumbumbus |
Description
What steps will reproduce the problem?
What is the expected result?
What happens instead?
Please provide any additional information below. Attach a screenshot if possible.
Build-Date:2022-06-17 19:35:03 Revision:18495 Is-Local-Build:true Identification: JOSM/1.5 (18495 SVN fr) Linux Ubuntu 18.04.6 LTS Memory Usage: 109 MB / 1820 MB (73 MB allocated, but free) Java version: 1.8.0_301-b09, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel Screen: :0.0 1920×1080 (scaling 1.00×1.00) Maximum Screen Size: 1920×1080 Best cursor sizes: 16×16→16×16, 32×32→32×32 Environment variable LANG: fr_FR.UTF-8 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: fr_FR Numbers with default locale: 1234567890 -> 1234567890 Desktop environment: GNOME-Flashback:GNOME fonts-noto: fonts-noto:- Plugins: + apache-commons + cadastre-fr + ejml + geotools + jaxb (35952) + jts + log4j (35924) + reverter + routing Last errors/warnings: - 00017.692 E: Exception raised in EDT: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError. Cause : java.lang.ExceptionInInitializerError. Cause : java.lang.NullPointerException - 00025.266 W: Version principale du greffon gpsbabelgui manquante. - 00029.674 W: Version principale du greffon gpsbabelgui manquante. - 00032.262 W: Version principale du greffon gpsbabelgui manquante. - 00033.717 E: Handled by bug report queue: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.actions.SessionSaveAction OSM API: http://www.openstreetmap.org/api === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: main (1) java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.actions.SessionSaveAction at org.openstreetmap.josm.gui.MainMenu.<init>(MainMenu.java:181) at org.openstreetmap.josm.gui.MainFrame.initialize(MainFrame.java:93) at org.openstreetmap.josm.gui.MainApplication.initializeMainWindow(MainApplication.java:415) at org.openstreetmap.josm.spi.lifecycle.InitializationTask.call(InitializationTask.java:33) at org.openstreetmap.josm.spi.lifecycle.Lifecycle.runInitializationTasks(Lifecycle.java:103) at org.openstreetmap.josm.spi.lifecycle.Lifecycle.initialize(Lifecycle.java:71) at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:953) at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:277) at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:741)
Attachments (2)
Change History (60)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:3 by , 2 years ago
Summary: | josm crashed at startup → NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.actions.SessionSaveAction |
---|
comment:4 by , 2 years ago
Ticket #22244 has been marked as a duplicate of this ticket.
FTR:
- 00000.954 E: Exception raised in EDT: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError. Ursache: java.lang.ExceptionInInitializerError. Ursache: java.lang.NullPointerException: Cannot invoke "javax.swing.JComponent.getInputMap(int)" because "org.openstreetmap.josm.gui.MainApplication.contentPanePrivate" is null
We probably ought to be opening the bug report ticket for the ExecutionException
.
comment:6 by , 2 years ago
For those running into this problem, can you please run JOSM with the --trace
option (on Ubuntu Linux, josm --trace
).
Please note that --trace
may expose sensitive information (specifically login information for various services, like OSM), so please only paste stack traces. Stack traces look like this:
java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.actions.SessionSaveAction at org.openstreetmap.josm.gui.MainMenu.<init>(MainMenu.java:181) at org.openstreetmap.josm.gui.MainFrame.initialize(MainFrame.java:93) at org.openstreetmap.josm.gui.MainApplication.initializeMainWindow(MainApplication.java:415) at org.openstreetmap.josm.spi.lifecycle.InitializationTask.call(InitializationTask.java:33) at org.openstreetmap.josm.spi.lifecycle.Lifecycle.runInitializationTasks(Lifecycle.java:103) at org.openstreetmap.josm.spi.lifecycle.Lifecycle.initialize(Lifecycle.java:71) at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:953) at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:277) at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:741)
I am specifically interested in a java.lang.NullPointerException
stack trace. It should have java.lang.ExceptionInInitializerError
and java.util.concurrent.ExecutionException
around it (please copy those as well).
comment:11 by , 2 years ago
Cc: | added |
---|
comment:12 by , 2 years ago
comment:15 by , 2 years ago
#22273 is the first one with r18531. I really wish we knew what exactly was causing the NPE.
It is occurring either on L589 (registerActionShortcut
) or L638 (getRegisteredActionShortcut
), based purely off of NullPointerException: Cannot invoke "javax.swing.JComponent.getInputMap(int)" because "org.openstreetmap.josm.gui.MainApplication.contentPanePrivate" is null
. And I'd bet it is registerActionShortcut
that is the problem. But I have no clue why it is not happening reliably (and no one with the problem has gotten back to us with the output I asked for in comment:6).
comment:17 by , 2 years ago
Can someone with this problem please give me information from comment:6? Or upload the actual jar file that is getting run?
I've been starting/stopping JOSM in a while loop, and at ~1200 runs (Ubuntu 22.04.1), I haven't encountered this issue, so I either need the information from comment:6 or better steps to reproduce. All indications from the bug reports is that this happens on startup.
The two while
loops (run in different terminals), for the record:
run=0; while [ true ]; do josm; ((run+=1)); echo "Run $run"; done
- JOSM takes 40-60s to start up
- Only has window title "Java OpenStreetMap Editor" once startup has finished
while [ true ]; do if [ $(wmctrl -l | wc -l) -le 2 ]; then wmctrl -c "Java OpenStreetMap Editor"; fi; sleep 2; done
- This closes windows with the title "Java OpenStreetMap Editor" every two seconds
follow-up: 19 comment:18 by , 2 years ago
@Taylor:
Did you test it with a user defined shortcut in preferences for either Add Source Tag from utilsplugin2 or for Save Session As…? The plugin could have been removed mean while. Even a toolbar item could have been defined for one or both of the two actions.
comment:20 by , 2 years ago
Sorry, do not have much time, e.g. I never tried. In the short sessions with rather new preferences it never crashed.
comment:21 by , 2 years ago
Most of the bug reports with useful user-provided information indicated it occurred on startup, so if it doesn't crash there you are fine. Which is why I had a while loop starting/stopping JOSM.
comment:26 by , 2 years ago
Priority: | normal → major |
---|
comment:27 by , 2 years ago
I'm seriously looking at modifying the bug report code so that we get the missing exceptions, but that isn't something I want to do right around a release.
comment:28 by , 2 years ago
OK. Here is what I think I'll do:
- Do a release with r18543
- Apply the patch
- Ask those encountering this problem to use
josm-latest
(I'll point them at the appropriate installer)
If I get better bug reports
- Fix the actual bug
- Make a new release
EDIT: I've attached a jar file for those who have reported this bug and know how to start the JOSM jar file. Considering the lack of responses from the bug reporters, I don't think any of them will use it.
EDIT2: As of r18549, the patch is in JOSM core. As such, the attached jar file has been removed.
by , 2 years ago
Attachment: | 22183.patch added |
---|
Better reporting of suppressed/ignored exceptions in EDT and worker threads
comment:33 by , 2 years ago
I've removed the custom jar file.
Users with this problem should attempt to reproduce using the new josm-latest revision (r18549). See https://github.com/JOSM/josm/releases/tag/18549 for installers for the various operating systems. Users should use the Java 17 installers if they use a newer revision. I will link the installers for r18549 on Mac and Windows below. Linux users should update using whatever method their Linux distribution recommends.
follow-up: 42 comment:38 by , 2 years ago
Cc: | added |
---|
#22358 is the first report with little more info.
comment:41 by , 2 years ago
Cc: | added |
---|
comment:42 by , 2 years ago
Replying to skyper:
#22358 is the first report with little more info.
Oddly enough, not using r18549, but it was using Java 18 (maybe some behavior changed in Java 18 which gives us better stack traces?).
Anyway, it looks like it is a race condition. I'll see if I can put something together to fix this. I won't be 100% certain (since I've never been able to reproduce), I think I can just synchronize and wait for contentPanePrivate
to be non-null.
by , 2 years ago
Attachment: | 22183.1.patch added |
---|
Use synchronization to wait for non-null contentPanePrivate
. Not ideal (due to synchronization), but should be safe.
comment:43 by , 2 years ago
NVM. I'm not seeing how that code is ever called prior to the setting of contentPanePrivate
. So something is preventing us from setting the contentPanePrivate
.
EDIT: I think I might do the following to get more information:
-
src/org/openstreetmap/josm/gui/MainApplication.java
diff --git a/src/org/openstreetmap/josm/gui/MainApplication.java b/src/org/openstreetmap/josm/gui/MainApplication.java
a b 856 856 if (contentPane instanceof JComponent) { 857 857 contentPanePrivate = (JComponent) contentPane; 858 858 } 859 if (!GraphicsEnvironment.isHeadless() && contentPanePrivate == null) { 860 throw new JosmRuntimeException("MainFrame content pane is " + (contentPane == null ? "null" : contentPane.getClass().getName())); 861 } 859 862 mainPanel = mainFrame.getPanel(); 860 863 861 864 if (args.hasOption(Option.LOAD_PREFERENCES)) {
comment:45 by , 2 years ago
For those affected, if it occurs on a semi-reliable basis, can you use the appropriate installers from https://github.com/JOSM/josm/releases/tag/18561 for your system? Or just the jar file once it updates (josm-latest.jar).
The code should throw an error much earlier, and will help debug why contentPanePrivate
is null
.
comment:51 by , 2 years ago
#22434 has a usable stack trace. Based off of the saved stack traces in #22434, it looks like this issue is occurring due to JOSM starting thinking it has access to ipv6, detecting that it does not in fact have access to ipv6, and attempting to restart. This fails, due to SessionSaveAction not being able to initialize, which in turn causes JOSM startup to not finish.
comment:53 by , 2 years ago
Cc: | added |
---|
I'm on the fence as to whether or not I should release a hotfix now that I think we have a fix (based off of the additional stack traces from #22434).
The only reason I'm somewhat ambivalent is due the non-bugfix commits since r18565. But most of the non-bugfixes are small, and I believe only r18566 changed a text (for addresses) that may be translated.
EDIT: To clarify, r18570 fixes the issue from #22434. I just don't know if other users are triggering the bug in different ways.
comment:54 by , 2 years ago
Milestone: | → 22.10 |
---|
comment:55 by , 2 years ago
I think you should release a hot fix.
I don't consider changes of translatable strings shortly before a release as crucial (anymore) because:
https://translations.launchpad.net/josm
JOSM has >13k translatable strings. Only a handful of languages keeps up with >99% translated strings.
- For all other languages with hundreds or thousands of untranslated strings, a few more don't matter at all.
- For languages with >99% translation rate, a few out of 13k is still >99%, so it doesn't matter too. Additional if an end user actually stubmles over a untranslated string in a >99%-language it might be a good thing, because it reminds him that translation doesn't happen by itself but needs people and might animate him to contribute to the translations :)
comment:56 by , 2 years ago
Fair enough. I'll wait for r18570 to show up as josm-latest
, then I'll start the release process. So probably tomorrow.
comment:58 by , 2 years ago
Milestone: | 22.10 → 22.09 |
---|
Did you build JOSM on your own? If yes, try again with
ant clean dist