Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » sudden crash with java.lang.NoClassDefFoundError(After some time application running on Windows Server crashes suddenly )
sudden crash with java.lang.NoClassDefFoundError [message #1852680] Tue, 31 May 2022 09:40 Go to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 91
Registered: November 2011
Location: Berlin, Germany
Member
Hello,

I have a weird problem with Eclipse applications running on a Windows Server 2019. After it was started it runs for some time without any problem and suddenly it crashes with an java.lang.NoClassDefFoundError.

The class which cannot be found differs, but is always one of the eclipse plugins. All files are in fact still there.

Here is an example:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/internal/win32/WINDOWPLACEMENT
        at org.eclipse.swt.widgets.Decorations.getLocationInPixels(Decorations.java:562)
        at org.eclipse.swt.widgets.Shell.getLocationInPixels(Shell.java:1000)
        at org.eclipse.swt.widgets.Decorations.WM_MOVE(Decorations.java:1566)
        at org.eclipse.swt.widgets.Shell.WM_MOVE(Shell.java:2279)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4768)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:335)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1480)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2100)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4749)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
        at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:508)
        at org.eclipse.swt.widgets.Control.WM_WINDOWPOSCHANGED(Control.java:5644)
        at org.eclipse.swt.widgets.Canvas.WM_WINDOWPOSCHANGED(Canvas.java:446)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4808)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:335)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1480)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2100)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4749)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method)
        at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:508)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4819)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:335)
        at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1480)
        at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2100)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4757)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3522)
        at test3.MyLayout.main(MyLayout.java:72)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.internal.win32.WINDOWPLACEMENT
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 28 more

My test application consists of just one class:
package test3;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;

public class MyLayout {
	public static void main (String [] args) {
		final Display display = new Display ();
		Shell shell = new Shell (display);
		RowLayout rowLayout = new RowLayout ();
		shell.setLayout (rowLayout);

		final Button button = new Button (shell, SWT.TOGGLE);
		button.setText ("button0");

		button.addListener(SWT.Selection, new Listener() {
			
			@Override
			public void handleEvent(Event event) {
				String text = button.getSelection() ? "ON" : "OFF";
				button.setText(text);
			}
		});
		final ProgressBar progressbar = new ProgressBar (shell, SWT.INDETERMINATE);
		progressbar.setVisible(false);

		button.addListener(SWT.Selection, new Listener() {
			
			@Override
			public void handleEvent(Event event) {
				progressbar.setVisible(button.getSelection());
			}
		});
		
		shell.pack ();
		shell.open ();

		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ())
				display.sleep ();
		}
		display.dispose ();
	}
}

The project was exported as runnable jar from Eclipse IDE 2020-03.
The manifest file looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test3
Bundle-SymbolicName: test3
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: test3
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.swt

It crashed when the application window was restored from minimized state.

Similar crashes occur for more complicated RAP applications. In those cases the application somehow freezes and can only be closed by the Windows task manager. This, again, happens after about 15 to 60 minutes the application was started and had run without any problem.

Here, e.g. these classes cannot be found:
java.lang.NoClassDefFoundError: org/eclipse/core/internal/registry/RegistryMessages
java.lang.NoClassDefFoundError: org/eclipse/swt/internal/win32/SIZE
java.lang.NoClassDefFoundError: org/eclipse/ui/statushandlers/StatusAdapter


The problem does NOT happen for pure Java applications that do not use Eclipse.

It also happens only on this Windows Server. On a Windows 10 computer it runs without any problem.

Thanks for any ideas!
Re: sudden crash with java.lang.NoClassDefFoundError [message #1852683 is a reply to message #1852680] Tue, 31 May 2022 13:36 Go to previous messageGo to next message
Andy Maleh is currently offline Andy MalehFriend
Messages: 75
Registered: March 2020
Location: Montreal, Quebec, Canada
Member
I don't know how well supported Windows Server is by Eclipse given that it is a server not a desktop expected to run GUI.

That said, I might have read somewhere that recently Eclipse had issues on windows because of the newish Windows built in virus scanner and firewall software, which sometimes affect the performance of the Eclipse IDE. Perhaps, you should create an Eclipse application exclusion in the virus scanner and firewall software.


EclipseCon / EclipseWorld / Agile Conference Speaker
Open-Source Software Author of Glimmer DSL for SWT
Re: sudden crash with java.lang.NoClassDefFoundError [message #1852760 is a reply to message #1852683] Fri, 03 June 2022 07:55 Go to previous message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 91
Registered: November 2011
Location: Berlin, Germany
Member
Thanks for your answer, Andy! I'll check that.

Update:
What I found out is that on a freshly installed Windows Server 2019 (free download 180 days test Version) this Error does not occur.
Windows defender settings are all on default.

Also different users logged in directly or via remote desktop all starting and running the same application does not make any problem.

The server where the error occurs, is a production system with many other processes running including a Citrix XenDesktop for remote access.

So the problem probably does not come from the Windows system itself but from additional software.

[Updated on: Fri, 01 July 2022 11:58]

Report message to a moderator

Previous Topic:TabItems are not visible on mac if there is not enough space
Next Topic:Eclipse 2022-06 and GTK+ Warnings on Ubuntu 16.04
Goto Forum:
  


Current Time: Mon May 06 20:53:56 GMT 2024

Powered by FUDForum. Page generated in 0.03427 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top