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

Provide more detailed error when class org.jvnet.winp.Native could not be initialized #56

Closed
segrey opened this issue Sep 28, 2018 · 5 comments

Comments

@segrey
Copy link
Contributor

segrey commented Sep 28, 2018

Sometimes return new WinProcess(myProcess).sendCtrlC(); fails with with the following exception:

java.lang.NoClassDefFoundError: Could not initialize class org.jvnet.winp.Native
	at org.jvnet.winp.WinProcess.<init>(WinProcess.java:46)
	at com.intellij.execution.process.KillableProcessHandler.destroyProcessGracefully(KillableProcessHandler.java:168)
	at com.intellij.execution.process.KillableProcessHandler.doDestroyProcess(KillableProcessHandler.java:143)
	at com.intellij.execution.process.KillableProcessHandler.destroyProcessImpl(KillableProcessHandler.java:127)
	at com.intellij.execution.process.ProcessHandler$1.run(ProcessHandler.java:100)
	at com.intellij.execution.process.ProcessHandler$TasksRunner.execute(ProcessHandler.java:256)
	at com.intellij.execution.process.ProcessHandler.destroyProcess(ProcessHandler.java:95)
	at com.intellij.execution.ui.RunContentManagerImpl$CloseListener.closeQuery(RunContentManagerImpl.java:696)
	at com.intellij.execution.ui.RunContentManagerImpl$CloseListener.contentRemoveQuery(RunContentManagerImpl.java:649)
	at com.intellij.ui.content.impl.ContentManagerImpl.fireContentRemoveQuery(ContentManagerImpl.java:561)
	at com.intellij.ui.content.impl.ContentManagerImpl.removeContent(ContentManagerImpl.java:201)
	at com.intellij.ui.content.impl.ContentManagerImpl.removeContent(ContentManagerImpl.java:166)
	at com.intellij.openapi.wm.impl.content.ContentTabLabel$1.lambda$getAction$0(ContentTabLabel.java:69)
	at com.intellij.openapi.wm.impl.content.ContentTabLabel$2.execute(ContentTabLabel.java:134)
	at com.intellij.util.ui.BaseButtonBehavior$MyMouseListener.execute(BaseButtonBehavior.java:173)
	at com.intellij.util.ui.BaseButtonBehavior$MyMouseListener.mouseReleased(BaseButtonBehavior.java:156)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6548)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
	at java.awt.Component.processEvent(Component.java:6313)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4903)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4725)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
	at java.awt.Container.dispatchEventImpl(Container.java:2281)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4725)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:737)
	at java.awt.EventQueue$4.run(EventQueue.java:735)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:718)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:663)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

The exception was received automatically from a WebStorm instance. It's also known that OS is Windows 10.
Unfortunately, there is no "caused by" linked exception making it impossible to figure out the cause.
Is it possible to enhance thrown exception?

@oleg-nenashev
Copy link
Member

Any chance to get more info, maybe there is some stacktrace below.
IIUC static initializer fails in https://github.com/kohsuke/winp/blob/master/src/main/java/org/jvnet/winp/Native.java#L93-L96 (CC @stephanreiter)

Just in case, which Java version do you use?

@segrey
Copy link
Contributor Author

segrey commented Sep 28, 2018

Just in case, which Java version do you use?

Actually, the error was thrown for one of our customers, it's not reproduced for me. All information we got in the automatic error report is:
IDE version: WebStorm 183.2635.17 (WebStorm 2018.3 EAP)
Java: 1.8.0_152 patched by JetBrains. It's bundled with the WebStorm.

This WebStorm build uses winp-1.27. If needed, here is the usage of winp in KillableProcessHandler.java.

Nope, no stacktrace below, unfortunately, thus the issue.

@segrey
Copy link
Contributor Author

segrey commented Sep 28, 2018

A possible fix could be to convert org.jvnet.winp.Native#ctrlCExePath to Future<String>. Then, each ctrlCExePath.get() will raise an exception or provide a value.
Or Exception object could be stored manually and re-thrown on each access.

@oleg-nenashev
Copy link
Member

Or Exception object could be stored manually and re-thrown on each access.

Maybe this one is preferable in this case.
At least we need to wrap it into WinpException so that errors get propagated to API users

@segrey
Copy link
Contributor Author

segrey commented Sep 28, 2018

@oleg-nenashev Yeap, looks good. Oh, I was wrong, it should better be Throwable, not Exception. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants