Opened 6 years ago

Last modified 6 years ago

#19173 closed defect

svn build with ant on Ubuntu 18.04/20.04 crashes with "Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager" at runtime — at Version 19

Reported by: mvogt Owned by: team
Priority: normal Milestone: 20.05
Component: Core Version:
Keywords: jcs cache logging serviceloader services meta-inf Cc: simon04, Don-vip

Description (last modified by simon04)

Building a working josm in a Ubuntu 18.04 environment from svn recently stopped working for me. I did svn co https://josm.openstreetmap.de/svn/trunk/ and ran "ant" in there.

I did build r15937 (and a bunch of version before that) and worked normally. When building r16239 the generated jar file will start but trying to download anything will fail with a crash:

2020-04-30 18:38:19.285 INFO: Obtained 57 Tag2Link rules from https://josm.openstreetmap.de/remote/wikidata-sparql
2020-04-30 18:38:19.325 INFO: Obtained 11 Tag2Link rules from https://josm.openstreetmap.de/remote/sophox-sparql
Warning: Nashorn engine is planned to be removed from a future JDK release
2020-04-30 18:38:28.332 INFO: Changeset updater active (checks every 60 minutes if open changesets have been closed)
2020-04-30 18:38:28.332 INFO: Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console
2020-04-30 18:38:33.673 SEVERE: Handled by bug report queue: java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager
java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager
	at org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer.getCache(AbstractCachedTileSourceLayer.java:118)
	at org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer.getTileLoaderFactory(AbstractCachedTileSourceLayer.java:106)
	at org.openstreetmap.josm.gui.bbox.JosmMapViewer.<init>(JosmMapViewer.java:148)
	at org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser.<init>(SlippyMapBBoxChooser.java:87)
	at org.openstreetmap.josm.gui.download.SlippyMapChooser.<init>(SlippyMapChooser.java:35)
	at org.openstreetmap.josm.gui.download.DownloadDialog.buildMainPanel(DownloadDialog.java:128)
	at org.openstreetmap.josm.gui.download.DownloadDialog.<init>(DownloadDialog.java:230)
	at org.openstreetmap.josm.gui.download.DownloadDialog.<init>(DownloadDialog.java:218)
	at org.openstreetmap.josm.gui.download.DownloadDialog.getInstance(DownloadDialog.java:84)
	at org.openstreetmap.josm.actions.DownloadAction.actionPerformed(DownloadAction.java:35)
	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:6631)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6396)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5007)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4839)
	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:4839)
	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)

I tried this on two different machines (20.04 and 18.04) with the same result. With jdk 8/11/14. I also tried to checkout r15937 to bisect but this checkout fails with:

svn: warning: W170000: URL 'https://github.com/apache/commons-jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs' at revision 3137 doesn't exist

Any hints what I can do to get to a working build would be greatly appreciated. Do I need to update anything on my side how I build josm?

Thanks,

Michael

Change History (23)

comment:1 by GerdP, 6 years ago

Did you try ant clean dist?

comment:2 by GerdP, 6 years ago

If that doesn't help please attach the build log. CompositeCacheManager was removed in r16335, so maybe you did not check out r16239, but the latest version?

comment:3 by mvogt, 6 years ago

Thanks @GertP - it looks like the missing CompositeCacheManager is a bit of a red-herring. I get this crash when trying to download a map in my svn build, adding debug prints shows that it fails in AbstractCachedTileSourceLayer.java:getCache() with "Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager" but there is really no more info. This is build with openJDK 11.0.7, I wonder if that could be related, I will try with a more recent jdk maybe. Sorry for this unclear report, it's puzzling because the josm-tested.jar that I can download from here works fine it seems.

by mvogt, 6 years ago

Attachment: svn-info.txt added

by mvogt, 6 years ago

Attachment: ant-clean-dist.txt added

by mvogt, 6 years ago

Attachment: java-jar-josm-error.txt added

comment:4 by mvogt, 6 years ago

I added some debug logs. The svn info output, the ant clean dist output and the log output when running. It crashes when I click on the download map data icon. However it works fine with the "josm-tested.jar" download from josm.org so I'm puzzled what my local build is doing wrong. I also added some debug prints in AbstractCachedTileSourceLayer.java:getCache() that shows that it tries to call JCSCacheManager.getCache(). I also add debug prints into JCSCacheManager itself which seems to be not printed at all (which is also puzzling).

comment:5 by GerdP, 6 years ago

josm-tested is built with jdk 8. JOSM is also built with jdk 11, but I don't know if it is expected to work. Sometimes unit tests fail with jdk 11, but not with jdk 8.

by GerdP, 6 years ago

Attachment: ant-clean-dist-jdk8.txt added

ant clean dist with JKD 8 on Windows

comment:6 by GerdP, 6 years ago

I've attached my log from ant.

This looks suspicious in your log:

resolve:
[ivy:resolve] ivy.instance reference an ivy:settings defined in an other classloader.  An new default one will be used in this project.
[ivy:resolve] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:resolve] :: Apache Ivy 2.5.0 - 20191020104435 :: https://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /tmp/3/trunk/ivysettings.xml 

See also output from automated builds for jdk8 and jdk11:
https://josm.openstreetmap.de/jenkins/job/JOSM/jdk=JDK8/6384/consoleFull
https://josm.openstreetmap.de/jenkins/job/JOSM/jdk=JDK11/6384/consoleFull

comment:7 by GerdP, 6 years ago

Just to make sure: I assume you use a clean checkout without any patches?

comment:8 by mvogt, 6 years ago

Description: modified (diff)
Summary: Building no longer includes "org/apache/commons/jcs/engine/control/CompositeCacheManager$ShutdownHook.class"svn build with ant on Ubuntu 18.04/20.04 crashes with "Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager" at runtime

I updated the description, it appears to be some build issue on Ubuntu (or maybe linux in general?). I did a fresh svn checkout in a pristine 18.04 VM, build with ant and ran with "java -jar ./dist/josm-custom.jar". Same crash though.

comment:9 by mvogt, 6 years ago

Also thanks to @GertP for all your help and hints, maybe I can dig a bit in the jenkins to see if there is anything done there that I miss.

comment:10 by mvogt, 6 years ago

@GertP - sorry, did miss the earlier question. Yes, this was tested with a fresh checkout without any patches. I did add a bunch of System.out.println() to get a feel for what is wrong but I did not get further than the java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager error.

comment:11 by GerdP, 6 years ago

duplicate of #19153?

comment:12 by mvogt, 6 years ago

@GerdP Could be, the error looks the same. But the other bug is a bit short on details. Also josm-testest.jar and josm-latest.jar works just fine for me, so the pre-build stuff is ok just building seems to be problematic.

comment:13 by stoecker, 6 years ago

Hmm, if it is happening with a fresh checkout something is wrong. I'd assume the build is not as fresh as you think. Did you try with a fully fresh checkout, i.e. delete JOSM dir and recheckout?

comment:14 by mvogt, 6 years ago

@stoecker Thanks for your feedback! I did a fresh checkout in a fresh VM ubuntu-18.04 VM, installed svn and all the build-dependencies (openjdk,ant,etc) and tested the generated jar - unfortunately it's the same error so I don't think this is an issue with a stable repo on the client. Happy to try more but both my java and my svn knowledge are a bit rusty and I ran out of ideas.

comment:15 by GerdP, 6 years ago

r16335 was the last change on JCSCacheManager. My next step would be to compile r16334.

comment:17 by anonymous, 6 years ago

Thanks @GerdP - I tried to "svn co -r16192" and got the following error:
"""
svn: warning: W205011: Error handling externals definition for 'trunk/src/org/apache/commons/jcs':
svn: warning: W170000: URL 'https://github.com/apache/commons-jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs' at revision 3137 doesn't exist
Checked out revision 16192.
svn: E205011: Failure occurred processing one or more externals definitions
"""
Any hints how I can fix this would be appreciated.

Next I tried -r16334 and it looks like the checkout of this revision works but r16334 crashes.

comment:18 by GerdP, 6 years ago

Cc: simon04 Don-vip added

I get the same warning and ant dist fails with various javac errors. See #16860.
I tried a clean checkout of r16195, get the same warning, but ant dist works and JOSM als seems to work.
I hope somebody else has an idea, I don't know any details about the changes reg. JCSCacheManager or ivy.

comment:19 by simon04, 6 years ago

Description: modified (diff)

This ticket is lacking necessary information (in particular the used Java JDK/JRE)


Thanks for your report, however your ticket is incomplete and therefore not helpful in its current form.

Please add all needed information according to this list:

  • The required parts of the Status Report from your JOSM.
  • Describe what behaviour you expected.
  • Describe what did happen instead.
  • Describe if and how the issue is reproducible.
  • Add any relevant information like error messages or screenshots.

To ensure that all technical relevant information is contained, create new tickets by clicking in JOSMs Main Menu on Helpsource:trunk/resources/images/bug.svg Report Bug.

Remember: This is a generic notice so we don't need to write the same stuff again and again. It may only apply in parts to the specific case!


Note: See TracTickets for help on using tickets.