saros icon indicating copy to clipboard operation
saros copied to clipboard

XStream not working with Java version 16 and above

Open chronolala opened this issue 4 years ago • 8 comments
trafficstars

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 avatar Apr 24 '21 02:04 chronolala

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

stuban avatar Jun 04 '21 13:06 stuban

https://github.com/saros-project/saros/issues/1142#issuecomment-854710066 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

EnderCrypt avatar Sep 15 '21 19:09 EnderCrypt

#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 avatar Dec 14 '21 20:12 srossbach

https://github.com/x-stream/xstream/issues/262

srossbach avatar Dec 14 '21 20:12 srossbach

#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

EnderCrypt avatar Dec 15 '21 02:12 EnderCrypt

#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: https://github.com/x-stream/xstream/issues/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 avatar Dec 16 '21 09:12 srossbach

@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.

srossbach avatar Jan 06 '22 21:01 srossbach

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

buri17 avatar Jan 31 '24 12:01 buri17