Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException: SequencedMap #385

Open
jukzi opened this issue Feb 6, 2024 · 4 comments
Open

ClassNotFoundException: SequencedMap #385

jukzi opened this issue Feb 6, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jukzi
Copy link
Contributor

jukzi commented Feb 6, 2024

When having both JDK 17 and JDK 21 configured in the IDE (and jdk 21 as default JRE) and launching a test case for a BREEE 17 project (Run As..), then it it fails
image
image

WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
java.lang.NoClassDefFoundError: java/util/SequencedMap
	at org.apache.felix.resolver.Candidates.<init>(Candidates.java:96)
	at org.apache.felix.resolver.ResolverImpl.getInitialCandidates(ResolverImpl.java:541)
	at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:431)
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:420)
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:374)
	at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolveRevisions(ModuleResolver.java:1084)
	at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolveRevisionsInBatch(ModuleResolver.java:1035)
	at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolve(ModuleResolver.java:951)
	at org.eclipse.osgi.container.ModuleResolver.resolveDelta(ModuleResolver.java:181)
	at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:714)
	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:660)
	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:648)
	at org.eclipse.osgi.storage.Storage.checkSystemBundle(Storage.java:431)
	at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:189)
	at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:108)
	at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:53)
	at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:46)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:342)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:267)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1432)
Caused by: java.lang.ClassNotFoundException: java.util.SequencedMap
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 27 more
An error has occurred. See the log file
null.

I understand it is compiled against JDK 21, but executed with JDK 17 by default
image

workaround: open the Launch configuration "Main" tab -> JDK 21 is automaically(!) selected:
image

There after "run" launches with 21 and test runs fine.

To my understanding the launchconfiguration should use JDK 21 even without using the configuration dialog

@jukzi jukzi added the bug Something isn't working label Feb 6, 2024
@SarikaSinha
Copy link
Member

@jukzi
Have you tried setting this in "Execution Environments" in the Java Preferences where the compatible JREs are listed?

@jukzi
Copy link
Contributor Author

jukzi commented Feb 13, 2024

When i set JavaSE-17 Execution Environment to JDK21, the error is gone. But that feels only like a workaround.
image
image

@SarikaSinha
Copy link
Member

That was the only purpose of allowing to set up the preferred JRE.

@laeubi
Copy link
Contributor

laeubi commented Mar 7, 2024

I understand it is compiled against JDK 21, but executed with JDK 17 by default

Given your screenshot I think this is a bug. If the JDK to compile is higher than the JDK selected by the project it must use the --target option an not use any later constructs, this Bug is probably suffering from the same behavior:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants