Search code examples
javaeclipsercpeclipse-mars

SWT error with eclispe Mars in RCP application java.lang.NoSuchMethodError: org.eclipse.swt.widgets.ToolBar.requestLayout()V


We have an existing RCP application working perfectly working with eclipse Luna.We are planning to migrate the eclipse to Mars.While migrating the eclipse to MARS we are getting SWT exception while launching the tool and the tool window is not getting launched properly.

Please help to resolve this issue. Exception stack trace is given below.

java.lang.NoSuchMethodError: org.eclipse.swt.widgets.Control.requestLayout()V at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.subscribeChildrenHandler(PartRenderingEngine.java:301) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler.handleEvent(EventObjectSupplier.java:80) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)


Solution

  • The stack trace shows that you are using the PartRenderingEngine from Eclipse Neon (4.6). This requires the Control.requestLayout method in the SWT code. This is a relatively new method and the version of SWT you are using does not have it.

    It is not clear from your question how you are managing to end up with an RCP like this. You must build an RCP from a single Eclipse release, you can't mix code from different releases safely.