testmycode / tmc-intellij

*BETA* TestMyCode plugin for IntelliJ IDEA
MIT License
24 stars 13 forks source link

Local tests don't run (java.lang.NoClassDefFoundError) #130

Open LofhJann opened 7 years ago

LofhJann commented 7 years ago

Running local tests on Maven managed exercise throws following exception (In form of IDE Error) without running tests. Course in question is https://tmc.mooc.fi/org/hy/courses/266 but I remember seeing similar problems with other courses aswell. Running 'mvn test' from Project directory causes no errors so the problem seems to be in plugin. Idea.log also didn't seem to provide anything interesting in matter apart from IDE error itself, attached it anyways below (renamed ideacrash.log)

org/apache/maven/shared/invoker/MavenInvocationException java.lang.NoClassDefFoundError: org/apache/maven/shared/invoker/MavenInvocationException at fi.helsinki.cs.tmc.langs.java.maven.MavenExecutors.tryAndExec(MavenExecutors.java:16) at fi.helsinki.cs.tmc.langs.java.maven.MavenPlugin.build(MavenPlugin.java:77) at fi.helsinki.cs.tmc.langs.java.AbstractJavaPlugin.runTests(AbstractJavaPlugin.java:126) at fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl.runTests(TaskExecutorImpl.java:37) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:40) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:19) at fi.helsinki.cs.tmc.core.utilities.ExceptionTrackingCallable.call(ExceptionTrackingCallable.java:34) at fi.helsinki.cs.tmc.intellij.services.TestRunningService.lambda$prepareThreadForRunningTests$0(TestRunningService.java:68) at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:170) at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:548) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:493) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157) at fi.helsinki.cs.tmc.intellij.services.ThreadingService.lambda$runWithNotification$0(ThreadingService.java:20) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:330) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.invoker.MavenInvocationException PluginClassLoader[fi.helsinki.cs.tmc, 1.0.8] com.intellij.ide.plugins.cl.PluginClassLoader@21235406 at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:65) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 20 more

ideacrash.log

ullebe1 commented 6 years ago

I can confirm this problem in the IAI18 course.

java.lang.NoClassDefFoundError: org/apache/maven/shared/invoker/MavenInvocationException at fi.helsinki.cs.tmc.langs.java.maven.MavenExecutors.tryAndExec(MavenExecutors.java:16) at fi.helsinki.cs.tmc.langs.java.maven.MavenPlugin.build(MavenPlugin.java:78) at fi.helsinki.cs.tmc.langs.java.AbstractJavaPlugin.runTests(AbstractJavaPlugin.java:136) at fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl.runTests(TaskExecutorImpl.java:39) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:40) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:19) at fi.helsinki.cs.tmc.core.utilities.ExceptionTrackingCallable.call(ExceptionTrackingCallable.java:39) at fi.helsinki.cs.tmc.intellij.services.TestRunningService.lambda$prepareThreadForRunningTests$0(TestRunningService.java:68) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144) at fi.helsinki.cs.tmc.intellij.services.ThreadingService.lambda$runWithNotification$0(ThreadingService.java:20) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.invoker.MavenInvocationException PluginClassLoader[fi.helsinki.cs.tmc, 2.0.2] com.intellij.ide.plugins.cl.PluginClassLoader@e4382c at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 20 more

System information: OS: Arch Linux Architecture: x86_64 Kernel: 4.18.6 Locale: en_DK.UTF-8 IntelliJ version: IntelliJ Ultimate 2018.2.3 Java environment: The one bundled with IntelliJ Ultimate 2018.2.3 TMC plugin version: 2.0.2

Rokirok commented 5 years ago

This is also a problem with Ohjelmoinnin MOOC 2019 Tried with multiple projects (01 and 02) both failed to test.

Stacktrace: java.lang.NoClassDefFoundError: org/apache/maven/shared/invoker/DefaultInvocationRequest at fi.helsinki.cs.tmc.langs.java.maven.MavenInvokatorMavenTaskRunner.exec(MavenInvokatorMavenTaskRunner.java:43) at fi.helsinki.cs.tmc.langs.java.maven.MavenExecutors.tryAndExec(MavenExecutors.java:16) at fi.helsinki.cs.tmc.langs.java.maven.MavenPlugin.build(MavenPlugin.java:78) at fi.helsinki.cs.tmc.langs.java.AbstractJavaPlugin.runTests(AbstractJavaPlugin.java:136) at fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl.runTests(TaskExecutorImpl.java:39) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:40) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:19) at fi.helsinki.cs.tmc.core.utilities.ExceptionTrackingCallable.call(ExceptionTrackingCallable.java:39) at fi.helsinki.cs.tmc.intellij.services.TestRunningService.lambda$prepareThreadForRunningTests$0(TestRunningService.java:68) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151) at fi.helsinki.cs.tmc.intellij.services.ThreadingService.lambda$runWithNotification$0(ThreadingService.java:20) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

System info: OS: MacOS Mojave 10.14 IntelliJ: IntelliJ Ultimate 2018.3.2 TMC Plugin: TMC Plugin 2.0.2 Java: java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

EDIT: mvn test works flawlessly, this bug has something to do with the plugin as the author mentioned.

NikoGrano commented 5 years ago

This seems to be problem in all Part 1. Can be reproduced with all platforms. Affects Java 8 =>

sreimavuo commented 5 years ago

Same problem with course "Web-palvelinohjelmointi Java 2019" (https://web-palvelinohjelmointi-19.mooc.fi/) when pressing the "Run tests for current project" button on top bar. IntelliJ IDEA used is version 2019.1 and TMC-plugin is latest available from IDEA plugin repository (v2.0.2).

java.lang.NoClassDefFoundError: org/apache/maven/shared/invoker/DefaultInvocationRequest at fi.helsinki.cs.tmc.langs.java.maven.MavenInvokatorMavenTaskRunner.exec(MavenInvokatorMavenTaskRunner.java:43) at fi.helsinki.cs.tmc.langs.java.maven.MavenExecutors.tryAndExec(MavenExecutors.java:16) at fi.helsinki.cs.tmc.langs.java.maven.MavenPlugin.build(MavenPlugin.java:78) at fi.helsinki.cs.tmc.langs.java.AbstractJavaPlugin.runTests(AbstractJavaPlugin.java:136) at fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl.runTests(TaskExecutorImpl.java:39) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:40) at fi.helsinki.cs.tmc.core.commands.RunTests.call(RunTests.java:19) at fi.helsinki.cs.tmc.core.utilities.ExceptionTrackingCallable.call(ExceptionTrackingCallable.java:39) at fi.helsinki.cs.tmc.intellij.services.TestRunningService.lambda$prepareThreadForRunningTests$0(TestRunningService.java:68) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151) at fi.helsinki.cs.tmc.intellij.services.ThreadingService.lambda$runWithNotification$0(ThreadingService.java:20) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

NikoGrano commented 5 years ago

Currently it seems the maintainer of repo have no means to fix this as it's been open issue since 2017

kuituhirvi commented 5 years ago

The work around for this is to open the test directory manually and run the tests, either individually or all at once. This is why the easiest fix could be to remove the "Run tests.." part from the plugin.

IntelliJ IDEA seems to have gone under a complete UI rewrite in 2017. The plugin is still being built against 2017.1.1. that is available for download here. This is why it seems to fix this the best way would be to do a complete rewrite of the plugin.

One change just for an example: https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/ui/JBProgressBar.java https://github.com/testmycode/tmc-intellij/blob/master/tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/ui/testresults/TestResultProgressBar.java

There is a good change of me being mistaken and if you manage to just make it work please do submit a pull request. If you do please submit a link to it to this thread. New plugin can then be built a using your patches. You can also just built the plugin, but it can be bit of a pain to do so.