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

Error executing 'com.github.gradusnikov.eclipse.plugin.assistai.main.command.3': java.lang.NullPointerException #23

Open
rkocri opened this issue Feb 20, 2024 · 2 comments

Comments

@rkocri
Copy link

rkocri commented Feb 20, 2024

Hi,
in eclipse 2022.9 I just see a white,m empty panel in the AssistAI view. When I select for example "discuss" in a random java-file I get the following error:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2024-02-20 13:14:18.572
!MESSAGE Command 'com.github.gradusnikov.eclipse.plugin.assistai.main.command.3' failed
!STACK 0
org.eclipse.core.commands.ExecutionException: Error executing 'com.github.gradusnikov.eclipse.plugin.assistai.main.command.3': java.lang.NullPointerException: Cannot invoke "com.github.gradusnikov.eclipse.assistai.prompt.ChatMessageFactory.createUserChatMessage(com.github.gradusnikov.eclipse.assistai.prompt.Prompts, com.github.gradusnikov.eclipse.assistai.handlers.Context)" because "this.chatMessageFactory" is null
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:170)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
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:4251)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
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:643)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
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:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Caused by: org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException: Cannot invoke "com.github.gradusnikov.eclipse.assistai.prompt.ChatMessageFactory.createUserChatMessage(com.github.gradusnikov.eclipse.assistai.prompt.Prompts, com.github.gradusnikov.eclipse.assistai.handlers.Context)" because "this.chatMessageFactory" is null
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:323)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
... 32 more
Caused by: java.lang.NullPointerException: Cannot invoke "com.github.gradusnikov.eclipse.assistai.prompt.ChatMessageFactory.createUserChatMessage(com.github.gradusnikov.eclipse.assistai.prompt.Prompts, com.github.gradusnikov.eclipse.assistai.handlers.Context)" because "this.chatMessageFactory" is null
at com.github.gradusnikov.eclipse.assistai.handlers.AssistAIHandlerTemplate.execute(AssistAIHandlerTemplate.java:112)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
... 37 more

@jukofyork
Copy link
Contributor

org.eclipse.e4.core.internal.di...

It's something to do with the dependantcy injection.

I had all sorts of weird null pointer exceptions from it: near identical classes with the same @singleton @creatable annotations, one failed one didn't. Then I had methods like getFilename() and getExtension() in the same class that did almost the same thing - again one would fail and the other not.

Then one day got the same error as you got and the dependantcy injection just totally failed and even reverting the plug in project and eclipse install would fix it!

So in the end I had to make a completely new plug in project and copy over each source file one-by-one stripping the dependantcy injection code out and now it all works fine again (including the eclipse.ui.menu context menu that I couldn't get to work due to null pointer exceptions before).

@AlessandroBorges
Copy link

Same issue here:
Command 'com.github.gradusnikov.eclipse.plugin.assistai.main.command.3' failed

But I have no annotation at all.

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

3 participants