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

XStream not working with Java version 16 and above #1142

Open
chronolala opened this issue Apr 24, 2021 · 8 comments
Open

XStream not working with Java version 16 and above #1142

chronolala opened this issue Apr 24, 2021 · 8 comments
Labels
Prio: Critical Type: Bug Issue that describes an unintended behavior of Saros

Comments

@chronolala
Copy link

Describe the bug
Saros panel is displaying an error after installation.

Here's a snippet of the error:
org.eclipse.core.runtime.CoreException: Plug-in saros.eclipse was unable to load class saros.ui.views.SarosView.
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:212)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:198)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:61)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:104)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:304)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:342)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)

Screenshots
image

Environment (please complete the following information):

  • OS: Windows 10
  • IDE 2020-09 (4.17.0)
  • Saros Version: I can't find the issue number, but I just installed it recently from the marketplace
@chronolala chronolala added State: Unconfirmed No Saros developer analyzed the bug Type: Bug Issue that describes an unintended behavior of Saros labels Apr 24, 2021
@stuban
Copy link

stuban commented Jun 4, 2021

Same here. But happens only if I run eclipse itself with java 16. Looks like some of the underlying libs are not compatible:

eclipse.buildId=4.19.0.I20210303-1800
java.version=16
java.vendor=AdoptOpenJDK
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.e4.ui.workbench
Error
Fri Jun 04 14:55:48 CEST 2021
Command 'saros.ui.commands.GettingStarted' failed

org.eclipse.core.commands.ExecutionException: Exception occured when loading the handler
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:287)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5831)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5092)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4570)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
Caused by: org.eclipse.core.runtime.CoreException: Plug-in saros.eclipse was unable to load class saros.ui.commandHandlers.GettingStartedHandler.
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:212)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:198)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
	at org.eclipse.ui.internal.handlers.HandlerProxy.loadHandler(HandlerProxy.java:342)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277)
	... 43 more
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle saros.eclipse (4156).
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:126)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:572)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:346)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:401)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:480)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:617)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:196)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
	at org.eclipse.ui.internal.services.WorkbenchServiceRegistry.getSourceProviders(WorkbenchServiceRegistry.java:170)
	at org.eclipse.ui.internal.services.SourceProviderService.readRegistry(SourceProviderService.java:104)
	at org.eclipse.ui.internal.Workbench$34.runWithException(Workbench.java:2288)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:36)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5941)
	at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
	at org.eclipse.ui.internal.Workbench.initializeDefaultServices(Workbench.java:2283)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1606)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2759)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:637)
	... 17 more
Caused by: org.osgi.framework.BundleException: Exception in saros.Saros.start() of bundle saros.eclipse.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:835)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:763)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1012)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:366)
	at org.eclipse.osgi.container.Module.doStart(Module.java:605)
	at org.eclipse.osgi.container.Module.start(Module.java:468)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:506)
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
	... 40 more
Caused by: java.lang.ExceptionInInitializerError
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:989)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:592)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:514)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:483)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:429)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:368)
	at saros.misc.xstream.XStreamFactory.getSecureXStream(XStreamFactory.java:20)
	at saros.misc.xstream.XStreamExtensionProvider.<init>(XStreamExtensionProvider.java:95)
	at saros.communication.extensions.InfoExchangeExtension$Provider.<init>(InfoExchangeExtension.java:41)
	at saros.communication.extensions.InfoExchangeExtension$Provider.<init>(InfoExchangeExtension.java:40)
	at saros.communication.extensions.InfoExchangeExtension.<clinit>(InfoExchangeExtension.java:20)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at saros.context.ContainerContext.installPacketExtensionProviders(ContainerContext.java:117)
	at saros.context.ContainerContext.initialize(ContainerContext.java:173)
	at saros.context.AbstractContextLifecycle.start(AbstractContextLifecycle.java:94)
	at saros.Saros.start(Saros.java:126)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:814)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:806)
	... 47 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @75693526
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
	at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
	... 68 more

Workaround is to run eclipse with java 11

@EnderCrypt
Copy link

#1142 (comment)
i have the exact same exception and problem

OS:
Manjaro GNU/Linux

Java:
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7)
OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode)

Eclipse:
Version: 2021-06 (4.20.0)
Build id: 20210612-2011

@srossbach
Copy link
Contributor

srossbach commented Dec 14, 2021

#1142 (comment) i have the exact same exception and problem

OS: Manjaro GNU/Linux

Java: openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7) OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode)

Eclipse: Version: 2021-06 (4.20.0) Build id: 20210612-2011

No you do not. If you look carefully at the post you had referenced it clearly states that using JRE/JDK 11 is not encountering this issue.

@srossbach srossbach changed the title Error displayed right after installation XStream not working with Java version 16 and above Dec 14, 2021
@srossbach srossbach added Prio: Critical and removed State: Unconfirmed No Saros developer analyzed the bug labels Dec 14, 2021
@srossbach
Copy link
Contributor

x-stream/xstream#262

@EnderCrypt
Copy link

#1142 (comment) i have the exact same exception and problem
OS: Manjaro GNU/Linux
Java: openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7) OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode)
Eclipse: Version: 2021-06 (4.20.0) Build id: 20210612-2011

No you do not. If you look carefully at the post you had referenced it clearly states that using JRE/JDK 11 is not encountering this issue.

yes i did, if you look carefully in my message you'll see i never said i had the same issue, just same exception and problem

ofcourse things are different, different java, different hardware, different operating systems, different configurations, different files, no 2 computer is ever going to be identical

but i understand your sentiment of not wanting "unrelated" posts in issues, however i wanted to help show that this wasnt just something one user had experienced (tag: unconfirmed) as i had gotten a blatantly identical stacktrace

@srossbach
Copy link
Contributor

#1142 (comment) i have the exact same exception and problem
OS: Manjaro GNU/Linux
Java: openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7) OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode)
Eclipse: Version: 2021-06 (4.20.0) Build id: 20210612-2011

No you do not. If you look carefully at the post you had referenced it clearly states that using JRE/JDK 11 is not encountering this issue.

yes i did, if you look carefully in my message you'll see i never said i had the same issue, just same exception and problem

ofcourse things are different, different java, different hardware, different operating systems, different configurations, different files, no 2 computer is ever going to be identical

but i understand your sentiment of not wanting "unrelated" posts in issues, however i wanted to help show that this wasnt just something one user had experienced (tag: unconfirmed) as i had gotten a blatantly identical stacktrace

What confuses me is that this issue should only "starting" with Java 16.

In reality the issue is present since Java 9. See: x-stream/xstream#101

It also depends if VM switches are turned on to allow illegal reflection access or not.

A workaround for now is either to downgrade to Java 15 or below, or to allow illegal reflection access.

However with Java 17 Saros will indeed stop working unless we either replace the XStream library or the issue is fixed in the XStream library.

@srossbach
Copy link
Contributor

@m273d15 Can we somehow manage to publish a new Saros Version (16.0.2) by using XStream Version 1.4.18 ?

Workaround for now (Eclipse):

Download https://repo1.maven.org/maven2/com/thoughtworks/xstream/xstream/1.4.18/xstream-1.4.18.jar

Locate the saros.core_0.2.0.jar file and open it (with the zip tool of your choice)

Delete the xstream-1.4.10.jar file inside the lib directory. Add the xstream-1.4.18.jar to the lib directory.

Open the file META-INF/MANIFEST.MF

Replace line lib/xstream-1.4.10.jar, with lib/xstream-1.4.18.jar,

Restart Eclipse and ensure the OSGI cache is purged.

@buri17
Copy link

buri17 commented Jan 31, 2024

The above workaround doesn't work for me.

As a workaround, I added the following lines to my eclipse.ini:

--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED

I was able to run saros 15.0.0 with Eclipse Version: 2023-12 (4.30.0) (Build id: 20231201-2043) and Java 17 (org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.9.v20231028-0858).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio: Critical Type: Bug Issue that describes an unintended behavior of Saros
Projects
None yet
Development

No branches or pull requests

5 participants