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 8

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 mvogt)

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:

java.lang.NoClassDefFoundError: Could not initialize class org.openstreetmap.josm.data.cache.JCSCacheManager

(full log at https://paste.ubuntu.com/p/f2Ht8RpZFb/)

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 (12)

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.

Note: See TracTickets for help on using tickets.