Modify

Opened 20 months ago

Last modified 17 months ago

#22913 new defect

NoClassDefFoundError: Could not initialize class com.sun.media.imageioimpl.plugins.pnm.PNMImageWriter

Reported by: anonymous Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report java17 openSUSE Cc: stoecker

Description

What steps will reproduce the problem?

  1. Click "New picture from clipboard"

What is the expected result?

A new layer with clipboard contents

What happens instead?

'Picturelayer' plugin reports "An unexpected exception"

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

Disable plugin 'openedata'& 'geotools' and the error disappears

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2023-04-27 16:45:28 +0200 (Thu, 27 Apr 2023)
Revision:18719
Build-Date:2023-04-28 01:30:56
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18719 en) Linux openSUSE Leap 15.4
Memory Usage: 3680 MB / 8012 MB (2254 MB allocated, but free)
Java version: 17.0.6+0-suse-150400.3.15.1-x8664, N/A, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 4480×1440 (scaling 1.00×1.00) :0.1 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 4480×1440
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: da_DK.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_DK
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: KDE
Java package: java-17-openjdk:x86_64-17.0.6.0
apache-commons-logging: apache-commons-logging:noarch-1.2
Program arguments: [start.joz]
Dataset consistency test: No problems found

Plugins:
+ FastDraw (36057)
+ Mapillary (2.1.3)
+ OpeningHoursEditor (35924)
+ PicLayer (1.0.2)
+ SimplifyArea (35978)
+ apache-commons (36034)
+ areaselector (1652822522)
+ austriaaddresshelper (master-4e80dc2e4261d321150187f4951684ad97342d5e)
+ buildings_tools (36011)
+ centernode (v1.0.4)
+ conflation (0.6.11)
+ easypresets (1623509627)
+ ejml (35924)
+ geotools (36068)
+ jackson (36034)
+ jaxb (35952)
+ josm_magic_wand (1.1.0)
+ jts (36004)
+ log4j (36034)
+ opendata (36076)
+ reverter (36043)
+ tageditor (36011)
+ terracer (35978)
+ todo (123)
+ turnlanes-tagging (v0.0.5)
+ turnrestrictions (36011)
+ undelete (36011)
+ utilsplugin2 (36011)

Tagging presets:
+ <josm.userdata>/EasyPresets.xml
+ ${HOME}/Diverse_OSM/Presets/Butikker.xml
+ https://josm.openstreetmap.de/josmfile?page=Presets/MastAndTower&zip=1

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/FixmeAndNote&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1

Last errors/warnings:
- 00005.549 E: Failed to locate image 'presets/nautical/waterway_riverbank.svg'
- 00005.549 W:  null: Could not get presets icon presets/nautical/waterway_riverbank.svg
- 00005.555 E: Failed to locate image 'presets/nautical/waterway_riverbank.svg'
- 00005.555 W:  Under_vejen_pipeline: Could not get presets icon presets/nautical/waterway_riverbank.svg
- 00009.935 W: Unable to find supported projection for layer Ortofoto forår 2019. Using EPSG:3857.
- 00009.935 W: Unable to find supported projection for layer Ortofoto forår 2019. Using EPSG:3857.
- 00010.067 W: Unable to find supported projection for layer Ortofoto forår 2021. Using EPSG:3857.
- 00010.067 W: Unable to find supported projection for layer Ortofoto forår 2021. Using EPSG:3857.
- 00021.105 E: Handled by bug report queue: java.lang.IllegalAccessError: class com.sun.media.imageioimpl.plugins.pnm.PNMImageWriter (in unnamed module @0x314b9e4b) cannot access class sun.security.action.GetPropertyAction (in module java.base) because module java.base does not export sun.security.action to unnamed module @0x314b9e4b
- 00074.353 E: Handled by bug report queue: java.lang.NoClassDefFoundError: Could not initialize class com.sun.media.imageioimpl.plugins.pnm.PNMImageWriter



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (20) of main
java.lang.NoClassDefFoundError: Could not initialize class com.sun.media.imageioimpl.plugins.pnm.PNMImageWriter
	at com.sun.media.imageioimpl.plugins.pnm.PNMImageWriterSpi.createWriterInstance(PNMImageWriterSpi.java:117)
	at java.desktop/javax.imageio.spi.ImageWriterSpi.createWriterInstance(ImageWriterSpi.java:351)
	at java.desktop/javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:851)
	at java.desktop/javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:835)
	at java.desktop/sun.awt.X11.XDataTransferer.getPlatformMappingsForFlavor(XDataTransferer.java:412)
	at java.desktop/sun.awt.datatransfer.DesktopDatatransferServiceImpl.getPlatformMappingsForFlavor(DesktopDatatransferServiceImpl.java:87)
	at java.datatransfer/java.awt.datatransfer.SystemFlavorMap.flavorToNativeLookup(SystemFlavorMap.java:447)
	at java.datatransfer/java.awt.datatransfer.SystemFlavorMap.getNativesForFlavor(SystemFlavorMap.java:561)
	at java.desktop/sun.awt.datatransfer.DataTransferer.getFlavorsForFormats(DataTransferer.java:458)
	at java.desktop/sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:88)
	at java.desktop/sun.awt.X11.XClipboard.getContents(XClipboard.java:108)
	at org.openstreetmap.josm.plugins.piclayer.layer.PicLayerFromClipboard.createImage(PicLayerFromClipboard.java:23)
	at org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract.initialize(PicLayerAbstract.java:164)
	at org.openstreetmap.josm.plugins.piclayer.actions.newlayer.NewLayerFromClipboardAction.actionPerformed(NewLayerFromClipboardAction.java:37)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
	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.AbstractButton.doClick(AbstractButton.java:374)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	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)

Attachments (0)

Change History (13)

comment:1 by skyper, 20 months ago

Keywords: java17 openSUSE added
Summary: New picture from clipboardNoClassDefFoundError: Could not initialize class com.sun.media.imageioimpl.plugins.pnm.PNMImageWriter

Looks like another duplicate of #21059.
You are missing some VM arguments on startup.
How do you install JOSM? You might want to take a look at Download.

comment:2 by taylor.smock, 20 months ago

Cc: stoecker added

Identification: JOSM/1.5 (18719 en) Linux openSUSE Leap 15.4

It looks like the user is probably just running java -jar ${josm.jar} since I don't see r18719 on https://software.opensuse.org/package/josm .

With that said, it looks like the openSUSE JOSM start script is missing many arguments.

The current openSUSE start script looks like

#!/bin/sh

LIBXCB_ALLOW_SLOPPY_LOCK=1 `perl -e '$res = "/usr/lib64/jvm/jre-11-openjdk/bin/java"; $res = "java" if !-f $res || qx(java -version 2>&1) !~ /version \"(\d+)/ || $1 >= 11; print $res'` -Xms128M -Xmx4096M -XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy -jar /usr/share/java/josm-tested.jar "$@"

Looking at source:trunk/native/linux/tested/usr/bin/josm, the openSUSE start script is missing:

  • --add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web
  • --add-exports=java.base/sun.security.action=ALL-UNNAMED
  • --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED
  • --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED"

Going through the openSUSE start script:

  • -XX:+UseParallelGC -- I have no clue if this is still useful; the default GC is G1 since Java 9, and G1 has had throughput improvements of ~15% between Java 8 and Java 17. There are some significant improvements to G1 in Java 18 (JDK-8017163).
  • -XX:+UseAdaptiveSizePolicy -- it looks like this is a default setting now, so probably not necessary
  • LIBXCB_ALLOW_SLOPPY_LOCK=1 -- almost certainly not necessary; it looks like it was a workaround for a libxcb locking bug issue in the 2008 timeframe.
  • -Xms128M -- sets the min heap, probably fine (MOTD is ~84M after GC)
  • -Xmx4096M -- sets the max heap, I don't think this is necessary anymore

comment:3 by stoecker, 20 months ago

Adapted SUSE package except for JavaFX where I still don't know how that would work for openSUSE.

in reply to:  3 comment:4 by taylor.smock, 20 months ago

I don't know how SUSE/openSUSE do their JavaFX installs, but if they put it in the same directory as the rest of the JDK (like Arch), then something like JAVAFX_HOME="$(ls /usr/lib/jvm/default-runtime/lib/javafx*.jar | tr "\n" ":" | sed '"'"'s/.$//'"'"')" should work. There is probably a better way though.

In any case, the only reason why we have a JavaFX dependency is MS Streetside (broken, it looks like MS killed the API it was using), matsim, and an audio player (in the JavaFX plugin), so not having JavaFX won't kill core functionality.

comment:5 by stoecker, 20 months ago

Package openjfx8 has "/usr/lib64/jvm/openjfx8/rt/lib/ext/jfxrt.jar" which seems to have the relevant stuff included.
But adding "--module-path /usr/lib64/jvm/openjfx8/rt/lib/ext/jfxrt.jar" seems not to help.

comment:6 by taylor.smock, 20 months ago

You probably want openjfx instead of openjfx8 -- I think openjfx8 was roughly the equivalent of the JavaFX that was in Java 8, while openjfx is what is currently released (AKA in a Java module form).

comment:7 by stoecker, 20 months ago

Well, that may be the reason... Nobody make a package for this yet :-)

comment:8 by anonymous, 20 months ago

as an Opensuse tumbleweed user, I also have this issue, mostly when spawning windows, like the download window. Not every time, but sometimes. I'm running JOSM simply by java -jar the file from the website. Running openjdk 17, as anything above doesn't work with JOSM.

comment:9 by taylor.smock, 20 months ago

@anonymous: Since you are running JOSM from the command line, you really need to look at either using our start script (see source:trunk/native/linux/tested/usr/bin/josm ) or keeping up with any additional arguments we end up needing. You (minimally) need to have at least the following:

  • --add-modules java.scripting,java.sql (we don't use JavaFX in JOSM core; you only need to append javafx.controls,javafx.media,javafx.swing,javafx.web if you have the JavaFX plugin installed, although I think we only have the other additional modules for plugins)
  • --add-exports=java.base/sun.security.action=ALL-UNNAMED
  • --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED
  • --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED

comment:10 by anonymous, 20 months ago

thanks for the reply. I will try changing the way I launch JOSM. It's just weird, since launching with simple java -jar seems to be the instructed way for the .jar on wiki pages like "Download" or "InstallNotes".

comment:11 by taylor.smock, 20 months ago

Technically, you should be able to just run java -jar -- we add the appropriate Add-Opens/Add-Exports to the manifest. With that said, now that I'm inspecting the generated manifest, I'm wondering if we need to fiddle with the generated Manifest.MF.

Add-Opens: java.base/java.lang java.base/java.nio java.base/jdk.intern
 al.loader java.base/jdk.internal.ref java.base/sun.security.x509 java
 .desktop/javax.imageio.spi java.desktop/com.sun.imageio.plugins.jpeg 
 java.desktop/javax.swing.text.html java.prefs/java.util.prefs
Add-Exports: java.base/sun.security.util java.desktop/com.apple.eawt j
 ava.desktop/com.sun.imageio.spi javafx.graphics/com.sun.javafx.applic
 ation jdk.deploy/com.sun.deploy.config

Of note (for us) is that java.desktop/javax.imageio.spi and java.desktop/com.sun.imageio.spi is split over multiple lines. I don't think we've seen any of the others in tickets recently.

comment:12 by taylor.smock, 20 months ago

Ignore what I said in comment:11.

From comment:10:ticket:21059,

These attributes are interpreted only in the main executable JAR file of an application, i.e., in the JAR file specified to the -jar option of the Java run-time launcher; they are ignored in all other JAR files.

So the exports we do for JOSM core cannot extend to plugins without the command line arguments, and the problem you are having is with plugins (PicLayerFromClipboard.createImage).

But now I'm wondering if we add a module-info file for JMapViewer and JOSM if plugins will be able to open up the modules they need to themselves via their own module-info files. We'd have to (minimally) add a hint as to what module name we would use (Automatic-Module-Name in the manifest), but that should be doable.

comment:13 by stoecker, 17 months ago

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to anonymous.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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