question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PP is incompatible with Java 17

See original GitHub issue

Describe the bug Java 17 is now available and the current LTS release. It now enforces strong encapsulation.

This behaviour was already the default in JDK 16, but overridden by PP using the flag --illegal-access=permit in PortfolioPerformance.ini. This flag has now been removed.

PP can therefore no longer load or save portfolio XMLs and reports with the following message:

OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class com.thoughtworks.xstream.converters.collections.TreeMapConverter
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:350)
	at name.abuchen.portfolio.model.ClientFactory.xstream(ClientFactory.java:1178)
	at name.abuchen.portfolio.model.ClientFactory.access$0(ClientFactory.java:1174)
	at name.abuchen.portfolio.model.ClientFactory$XmlSerialization.load(ClientFactory.java:104)
	at name.abuchen.portfolio.model.ClientFactory$PlainWriter.load(ClientFactory.java:142)
	at name.abuchen.portfolio.model.ClientFactory.load(ClientFactory.java:415)
	at name.abuchen.portfolio.ui.editor.LoadClientThread.run(LoadClientThread.java:34)

(Note that the same stacktrace was observed in #2440; for some reason a new installation fixed the problem there. However, having a Java 17 installed as the system default, I can reliably reproduce the above error even after a clean reinstallation.)

PP should update and/or avoid dependencies that access internals of other modules (which has been deprecated since Java 9), to maintain compatibility with modern Java releases.

To Reproduce Steps to reproduce the behavior:

  1. Have the system’s default Java be version 17 (if necessary, install via APT and sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java)
  2. Run PortfolioPerformance
  3. Try to open a portfolio XML file.

Alternatively, try creating a new portfolio file (this works) and save it (this doesn’t).

Now, set system Java to another version (sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java) and try again - PP works as expected.

Expected behavior PP loads and saves portfolios from/to XML files.

Screenshots:

Loading a file:

image

The UI (e.g., menu bar) remains responsive, but loading does not continue.

Saving a file:

image

The save file is created but remains empty.

Desktop:

  • OS: Linux x86_64 (Xubuntu 21.04 hirsute)
  • Version: 0.55.0
  • Java: 17+35-Ubuntu-121.04 installed via APT (openjdk-17-jre:amd64, version 17+35-1~21.04)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
flabbergastcommented, Oct 14, 2021

Same problem here, this time on Arch Linux with the default openjdk as of now. Installing jdk11-openjdk and switching to it with archlinux-java set java-11-openjdk “fixes” the issue - now my portfolio file actually opens.

0reactions
mgehacommented, Jul 4, 2022

Seems like gentoo now comes with openjdk-17 per default. You can install v11 in parallel and then switch the version to 11 for your user only:

$ eselect java-vm set user openjdk-bin-11

Read more comments on GitHub >

github_iconTop Results From Across the Web

PP is incompatible with Java 17 - portfolio - Issues Antenna
Describe the bug Java 17 is now available and the current LTS release. It now enforces strong encapsulation. This behaviour was already the...
Read more >
Compatibility Guide for JDK 8 - Oracle
The following compatibility documents track incompatibility between adjacent Java versions. For example, this compatibility page reports only Java SE 8 ...
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
This error implies that the Java compiler is unable to resolve a value assigned to a variable or returned by a method, because...
Read more >
Incompatible Java Versions for WindowBuilder - Stack Overflow
Just change the compliance level of the project from 10 to 1.8, rebuild and the Design tab should work: To change the project's...
Read more >
Java 17 features: A comparison between versions 8 and 17
Read about Java 17 features and get insight on upgrading your Java to ... alterations that were incompatible with previous Java versions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found