Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17881 closed defect (fixed)

Could not load plugin, main class not found

Reported by: Ralpha Owned by: Don-vip
Priority: normal Milestone: 19.06
Component: Core Version:
Keywords: template_report, plugin Cc:

Description

What steps will reproduce the problem?

  1. Go to preferences
  2. Install any plugin (tested with SimplifyArea and Utilsplugin2), click 'Update plugins'
  3. (everything looks correct up until now)
  4. Press 'ok'
  5. Error thrown here

What is the expected result?

That the plugin is enabled and works.

What happens instead?

An error message (on screen and in terminal)

Please provide any additional information below. Attach a screenshot if possible.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2019-06-03 00:05:30 +0200 (Mon, 03 Jun 2019)
Revision:15155
Build-Date:2019-06-02 22:10:24
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (15155 en) Linux Mint 19.1 Tessa
Memory Usage: 371 MB / 3000 MB (217 MB allocated, but free)
Java version: 11.0.3+7-Ubuntu-1ubuntu218.04.1, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080, :0.1 1920x1080, :0.2 1920x1080
Maximum Screen Size: 1920x1080
Java package: openjdk-11-jre:amd64-11.0.3+7-1ubuntu2~18.04.1
VM arguments: [-Djosm.restart=true, -Djava.net.useSystemProxies=true]

Last errors/warnings:
- W: No configuration settings found.  Using hardcoded default values for all pools.
- W: Region [WMS_BLOCK_v2] Resetting cache
- W: Region [WMTS_BLOCK_v2] Resetting cache
- W: Invalid jar file ''<josm.pref>/plugins/SimplifyArea.jar.new'' (exists: false, canRead: false)
- E: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin SimplifyArea. Cause: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.simplifyarea.SimplifyAreaPlugin
- W: Disable plugin - <html>Could not load plugin 'SimplifyArea' because the plugin<br>main class 'org.openstreetmap.josm.plugins.simplifyarea.SimplifyAreaPlugin' was not found.<br>Delete from preferences?</html>
- E: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin utilsplugin2. Cause: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
- W: Disable plugin - <html>Could not load plugin 'utilsplugin2' because the plugin<br>main class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found.<br>Delete from preferences?</html>

Following message will be displayed:
https://i.imgur.com/HoeMf7H.png
Transcription of image:
Disable plugin - Could not load plugin 'utilsplugin2' because the plugin
main class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found.
Delete from preferences?
Disable plugin - Keep plugin

Error in terminal:

2019-07-06 23:48:31.012 SEVERE: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin utilsplugin2. Cause: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin utilsplugin2
	at org.openstreetmap.josm.plugins.PluginInformation.loadClass(PluginInformation.java:382)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugin(PluginHandler.java:801)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugins(PluginHandler.java:890)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane$PluginDownloadAfterTask.run(PreferenceTabbedPane.java:172)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.savePreferences(PreferenceTabbedPane.java:428)
	at org.openstreetmap.josm.gui.preferences.PreferenceDialog$OKAction.actionPerformed(PreferenceDialog.java:202)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6397)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
	at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
	at java.desktop/java.awt.Dialog.show(Dialog.java:1070)
	at java.desktop/java.awt.Component.show(Component.java:1716)
	at java.desktop/java.awt.Component.setVisible(Component.java:1663)
	at java.desktop/java.awt.Window.setVisible(Window.java:1031)
	at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1005)
	at org.openstreetmap.josm.gui.preferences.PreferenceDialog.setVisible(PreferenceDialog.java:143)
	at org.openstreetmap.josm.actions.PreferencesAction.run(PreferencesAction.java:112)
	at org.openstreetmap.josm.actions.PreferencesAction.actionPerformed(PreferencesAction.java:101)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6397)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at org.openstreetmap.josm.plugins.PluginClassLoader.loadClass(PluginClassLoader.java:73)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at org.openstreetmap.josm.plugins.PluginInformation.loadClass(PluginInformation.java:380)
	... 87 more

2019-07-06 23:48:31.016 WARNING: Disable plugin - <html>Could not load plugin 'utilsplugin2' because the plugin<br>main class 'org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2' was not found.<br>Delete from preferences?</html>

Tested this with JOSM version 15155 and JOSM version 15214 (latest).
With both JRE 8 and JRE 11

Jar file was not downloaded to ~/.josm/plugins first but later created directory after manualy adding the .josm folder.

Jar files are identical in all locations below.
utilsplugin2.jar:

Last modified: 14/04/2019
sha512sum: c39cdbb3df31b12ce4d78d35022da55d66d3561bf7b1bee2c308a0aed9353b7b74cf6b740a8076b44da2355bc40aa321454be2e52c3042f64b9b9b4b59f4877a

Jar exists in:
~/.josm/plugins/utilsplugin2.jar
~/.local/share/JOSM/plugins/utilsplugin2.jar
~/.local/share/JOSM-latest/plugins/utilsplugin2.jar

This was a clean install from JOSM.

Attachments (0)

Change History (15)

comment:1 by Don-vip, 5 years ago

Keywords: linux mint added
Owner: changed from team to Ralpha
Status: newneedinfo

You shouldn't have 3 copies of the plugin. Try to delete everything and get a clean environment by downloading plugins again from JOSM. They should be downloaded once in $HOME/.local/share/JOSM or $HOME/.local/share/JOSM-latest (please choose a single version too), see Help/Preferences#Linux

comment:2 by Ralpha, 5 years ago

After removing all folders with preferences, user data and caches I still get the same error.

Also after not being able to install the plugin and then restarting JOSM, I still see it being loaded during startup:
https://i.imgur.com/8DM0sQ3.png

Although it is under 'Removing unmaintained plugins...'

When I remove the file from the filesystem it will not show up on the loading screen. So JOSM does find the file.

I tested some other plugins like 'Create_grid_of_ways' and 'areaselector', they seem to load just fine.
Might the problem be in the plugin? (or version of the plugin?)

comment:3 by Ralpha, 5 years ago

I did a test on a different system, an old Linux Mint 17.3 system. (most other things are different on this system, different JVM, different software,...)
Also a clean install of JOSM, the same errors.

It downloads the plugin to the right folder.

I think it is a problem with the version of the plugin or something. Or just a problem with Linux Mint (but this seems unlikely)

comment:4 by Don-vip, 5 years ago

In 15221/josm:

see #17881 - add more precise error log

comment:5 by Ralpha, 5 years ago

I found the problem.
The problem is with enabling the plugin. When I go and manually change the ~/.config/JOSM/preferences.xml and added:

<list key='plugins'>
<entry value='tageditor'/>
<entry value='utilsplugin2'/>                   <--- This line
</list>

I can load JOSM with the plugin enabled without and problems.

comment:6 by Don-vip, 5 years ago

Still you shouldn't have faced the problem. Can you please try to deactivate utilsplugin2, relaunch JOSM r15221+, see if you get the error and copy/paste the error log?

Version 0, edited 5 years ago by Don-vip (next)

comment:7 by Ralpha, 5 years ago

Using version 15221:
Java version: 11.0.3

Here the error log:

2019-07-07 15:19:30.769 INFO: Plugins up to date - All installed plugins are up to date. JOSM does not have to download newer versions.
2019-07-07 15:19:32.670 SEVERE: Unable to load class org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2 from plugin utilsplugin2 using classloader PluginClassLoader [urls=[]]: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at org.openstreetmap.josm.plugins.PluginClassLoader.loadClass(PluginClassLoader.java:73)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at org.openstreetmap.josm.plugins.PluginInformation.loadClass(PluginInformation.java:384)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugin(PluginHandler.java:801)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugins(PluginHandler.java:890)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane$PluginDownloadAfterTask.run(PreferenceTabbedPane.java:172)
	at org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.savePreferences(PreferenceTabbedPane.java:428)
	at org.openstreetmap.josm.gui.preferences.PreferenceDialog$OKAction.actionPerformed(PreferenceDialog.java:202)

I think that plugins that do not require a restart of JOSM all give this/simular errors.

Last edited 5 years ago by Don-vip (previous) (diff)

comment:8 by Don-vip, 5 years ago

OK the classloader being empty, there's no chance to load the class:

using classloader PluginClassLoader [urls=[]]

But during my tests I didn't observe the problem. Strange.

comment:9 by Don-vip, 5 years ago

In 15223/josm:

see #17881 - use plugin name for plugin classloaders map keys

comment:10 by Don-vip, 5 years ago

@Ralpha can you please check with r15224+? It may fix the issue.

comment:11 by Ralpha, 5 years ago

Version 15224 does not seem to solve the issue.

Error looks the same.

$ josm-latest 
Using /usr/lib/jvm/java-11-openjdk-amd64/bin/java to execute josm-latest.
2019-07-07 18:00:08.897 INFO: Log level is at INFO (INFO, 800)
Warning: Nashorn engine is planned to be removed from a future JDK release
Warning: Nashorn engine is planned to be removed from a future JDK release
2019-07-07 18:00:16.160 WARNING: No configuration settings found.  Using hardcoded default values for all pools.
2019-07-07 18:00:16.475 INFO: Changeset updater active (checks every 60 minutes if open changesets have been closed)
2019-07-07 18:00:20.423 WARNING: Region [WMS_BLOCK_v2] Resetting cache
2019-07-07 18:00:20.431 WARNING: Region [WMTS_BLOCK_v2] Resetting cache
2019-07-07 18:00:20.481 INFO: Defaults for draw.rawgps.layer.wpt.pattern differ: ?{ '{name} ({desc})' | '{name} ({cmt})' | '{name}' | '{desc}' | '{cmt}' } != 
2019-07-07 18:00:20.484 INFO: Defaults for draw.rawgps.layer.audiowpt.pattern differ: ?{ '{name}' | '{desc}' | '{formattedWaypointOffset}' } != 
2019-07-07 18:00:30.899 INFO: GET https://josm.openstreetmap.de/pluginicons -> 200
2019-07-07 18:00:32.243 INFO: Plugins up to date - All installed plugins are up to date. JOSM does not have to download newer versions.
2019-07-07 17:45:28.601 SEVERE: Unable to load class org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2 from plugin utilsplugin2 using classloader PluginClassLoader [urls=[]]: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at org.openstreetmap.josm.plugins.PluginClassLoader.loadClass(PluginClassLoader.java:73)
...

This may help with reproducing the error, a screen recording of version 15224: https://youtu.be/EayBIsFRZwU

comment:12 by Don-vip, 5 years ago

Component: PluginCore
Keywords: linux mint removed
Milestone: 19.06
Owner: changed from Ralpha to Don-vip
Status: needinfoassigned

Thanks for the video, I can reproduce now.

comment:13 by Don-vip, 5 years ago

Resolution: fixed
Status: assignedclosed

In 15227/josm:

fix #17881 - fix bad refresh of plugin jar files after plugin update

comment:14 by Ralpha, 5 years ago

I needed to remove all the settings (or some part of it, maybe the plugin .jar only, don't know):
~/.local/share/JOSM
~/.config/JOSM

But after that, I tested with version 15234 and the problem is solved.

Thanks Don-vip.

2019-07-08 15:20:33.879 INFO: Update plugins - <html>The following plugin has been downloaded <strong>successfully</strong>:<ul><li>utilsplugin2 (34977)</li></ul></html>
2019-07-08 15:20:36.846 INFO: loading plugin 'utilsplugin2' (version 34977)

comment:15 by Don-vip, 5 years ago

Ticket #14174 has been marked as a duplicate of this ticket.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.