#22057 closed defect (fixed)
[Patch]ClassNotFoundException when installing a plugin that was already downloaded
Reported by: | Emvee | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 22.05 |
Component: | Plugin | Version: | |
Keywords: | Cc: |
Description
I suddenly lost my ~/.config/JOSM/preferences.xml (also the backup) so I had to reconfigure Josm.
One of the plugins I use often is utilsplugins2 but installing that pops up a warning:
Could not load plugin 'utilsplugins2' because the plugin main class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found. Delete from preferences?
The the choice "Disable plugin" or "Keep plugin" is given and I did chose "Keep plugin".
After a restart I see the settings menu got a "Utilplugin2 settings" menu and there I can edit the "Custom URL settings". I see also the additional tools under "More tools" so that all seems to work.
First the added shortcut keys (Ctrl-H, Ctrl-T etc.) did not work but after some more testing that did also work.
So I see no problems yet with the operation, still I do not like this "Disable plugin" when installing the plugin. I have tried 3 times reinstalling the plugin and could every time reproduce the problem
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2022-04-04 22:26:00 +0200 (Mon, 04 Apr 2022) Revision:18427 Build-Date:2022-04-05 01:30:55 URL:https://josm.openstreetmap.de/svn/trunk Identification: JOSM/1.5 (18427 en) Linux openSUSE Tumbleweed Memory Usage: 2474 MB / 5461 MB (1375 MB allocated, but free) Java version: 11.0.15+10-suse-1.1-x8664, Oracle Corporation, OpenJDK 64-Bit Server VM Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel Environment variable LANG: en_NL.UTF-8 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: en_NL Numbers with default locale: 1234567890 -> 1234567890 Desktop environment: KDE Java package: java-11-openjdk:x86_64-11.0.15.0 apache-commons-logging: apache-commons-logging:noarch-1.2 Dataset consistency test: No problems found Plugins: + ColumbusCSV (35949) + Mapillary (2.0.0-beta.9) + PolygonCutOut (v0.7) + alignways (35951) + apache-commons (35924) + apache-http (35924) + jna (35924) + reverter (35893) + utilsplugin2 (35951) Tagging presets: + http://mijndev.openstreetmap.nl/~allroads/JOSM/Presets/NL-Fiets.zip Map paint styles: + ${HOME}/Documents/Development/josm/resources/styles/NL_traffic_signs/Styles_Traffic_signs-style.mapcss + ${HOME}/Documents/Development/josm/resources/styles/Road_Extended/Road_Extended_JOSM_style.mapcss Last errors/warnings: - 00011.340 E: Invalid setting (Icon missing): org.openstreetmap.josm.plugins.columbusCSV.ColumbusCSVPreferences - 00353.585 E: Invalid setting (Icon missing): org.openstreetmap.josm.plugins.columbusCSV.ColumbusCSVPreferences
Attachments (1)
Change History (16)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Hm, cannot reproduce the problem on Windows and a clean installation. I tried different Java versions.
What exactly do you do to install the plugin? Do you install other plugins before or change any settings?
comment:3 by , 3 years ago
Ah, sorry, now I can reproduce. I simply removed both preferences.* files from the JOSM directory and kept all the installed plugins.
So, that's really a special case.
comment:4 by , 3 years ago
Okay, that is good to know, agreed this is (hopefully ;-) a special case. It was the first time I lost my preferences.xml.
I wonder what is now still different in preferences.xml that makes that I can reproduce this problem.
comment:5 by , 3 years ago
Interesting point: I only see the problem when I refresh the plugin list. I'll try to debug this...
by , 3 years ago
Attachment: | 22057.patch added |
---|
OK, I understand now why this special case happens and I have a possible simply fix, but I've no idea about possible side effects.
comment:6 by , 3 years ago
Summary: | Could not load plugin 'utilsplugin2' because class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found → [Patch]Could not load plugin 'utilsplugin2' because class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found |
---|
comment:7 by , 3 years ago
Thanks for looking into the issue!
I have the source of josm checked out but never did build josm yet, let me give that a try with the patch.
Unlike I earlier wrote is notice some strange behavior. Use custom URL (Ctrl-H) does only work when a object is select, while in the past I could also with having objects selected. Furthermore, there is no choice given, a/the URL is immediately loaded so it looks like some utilsplugin2 configuration is missing. Also I am missing a button belonging to http://mijndev.openstreetmap.nl/~allroads/JOSM/Presets/NL-Fiets.zip
Would it be a better idea to reinstall josm, although that is not re-installing preferences.xml so I probably should remove it before trying a reinstall.
> rpm -ql josm /usr/bin/josm /usr/share/applications/josm.desktop /usr/share/java/josm-tested.jar /usr/share/mime/packages/josm.xml /usr/share/pixmaps/josm.png
comment:8 by , 3 years ago
Whatever further problems you have, they are not related to this ticket, but to missing configurations which got lost with the preferences.xml. Please add new tickets for them unless you just have to redo your configuration.
comment:9 by , 3 years ago
I did a reinstall by completely removing ~/.config/JOSM, ~/.local/share/JOSM and ~/.cache/JOSM and with that the problems are gone.
Installing utilsplugin2 is working again without error and Use custom URL (Ctrl-H) is asking for the URL again after enabling "Ask every time" in the Data -> Select Custom URL menu.
Only thing still missing was a tagging button for NL-Fiets, but I found again I could add that using Preferences Toolbar.
With that everything is working again.
comment:10 by , 3 years ago
Component: | Plugin utilsplugin2 → Plugin |
---|
There really was no need to reinstall, the only problem is the error message and the required restart. The patch should fix that.
comment:11 by , 3 years ago
Summary: | [Patch]Could not load plugin 'utilsplugin2' because class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found → [Patch]ClassNotFoundException when installing a plugin that was already downloaded |
---|
How to reproduce:
- Install a plugin, e.g. utils2plugin
- stop JOSM
- remove/rename both preferences.xml and the preferences.xml_backup
- start JOSM
- open plugin preferences
- download list of plugins
- install same plugin (again)
JOSM neither downloads the jar nor finds the already installed jar and shows the error message. After restart, the installed plugin is found and everything works as expected.
The patch allows to find the already installed jar.
comment:13 by , 3 years ago
Okay, by removing ~/.local/share/JOSM (and therby the plugin .jar's) I was also able to fix the problem but this is a much nicer solution, thanks!
The other errors I had were because it was a long time ago I did these settings and it did take time to find out how to do them again.
comment:14 by , 3 years ago
Milestone: | → 22.04 |
---|
The plugin is configured to be "loadable" without a restart after installation. Seems that's no longer correct?