Aalto-LeTech / aplus-courses

A+ Courses is a plugin for IntelliJ IDEA, used in programming courses at Aalto University
https://plugins.jetbrains.com/plugin/13634-a-courses
MIT License
16 stars 7 forks source link

Unable to use the plugin #600

Closed LingarajVB closed 3 years ago

LingarajVB commented 3 years ago

Describe the bug

When i press "Turn project into A+", i am getting the following error on my mac

To Reproduce

Steps to reproduce the behavior:

  1. Go to the plugin on the top after installing
  2. Click on 'Turn project into A+ project'
  3. You will now see error: "The A+ Courses plugin encountered a network error: Please check your network connection and try again. Error message: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. "

Expected behavior

I expect that this could have happened because of some untrusted certificate or something, not sure.

Screenshots

image

Environment (please complete the following information):

Additional context

When i click on "refresh module" image Getting following error logs:

java.lang.IllegalStateException: @NotNull method fi/aalto/cs/apluscourses/ui/utils/TreeModelBuilder.getUserObject must not return null at fi.aalto.cs.apluscourses.ui.utils.TreeModelBuilder.$$$reportNull$$$0(TreeModelBuilder.java) at fi.aalto.cs.apluscourses.ui.utils.TreeModelBuilder.getUserObject(TreeModelBuilder.java:33) at fi.aalto.cs.apluscourses.ui.base.TreeView.getViewModel(TreeView.java:41) at fi.aalto.cs.apluscourses.ui.exercise.ExercisesTreeRenderer.customizeCellRenderer(ExercisesTreeRenderer.java:46) at com.intellij.ui.ColoredTreeCellRenderer.rendererComponentInner(ColoredTreeCellRenderer.java:118) at com.intellij.ui.ColoredTreeCellRenderer.getTreeCellRendererComponent(ColoredTreeCellRenderer.java:53) at com.intellij.ui.tree.ui.DefaultTreeUI.getRenderer(DefaultTreeUI.java:159) at com.intellij.ui.tree.ui.DefaultTreeUI.access$500(DefaultTreeUI.java:50) at com.intellij.ui.tree.ui.DefaultTreeUI$1.getNodeDimensions(DefaultTreeUI.java:365) at java.desktop/javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:493) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1344) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:723) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:111) at java.desktop/javax.swing.plaf.basic.BasicTreeUI.configureLayoutCache(BasicTreeUI.java:2103) at java.desktop/javax.swing.plaf.basic.BasicTreeUI.completeUIInstall(BasicTreeUI.java:812) at java.desktop/javax.swing.plaf.basic.BasicTreeUI.installUI(BasicTreeUI.java:772) at java.desktop/javax.swing.JComponent.setUI(JComponent.java:688) at java.desktop/javax.swing.JTree.setUI(JTree.java:706) at com.intellij.ui.treeStructure.Tree.setUI(Tree.java:108) at java.desktop/javax.swing.JTree.updateUI(JTree.java:727) at com.intellij.openapi.ui.ThreeComponentsSplitter.updateComponentTreeUI(ThreeComponentsSplitter.java:519) at com.intellij.openapi.ui.ThreeComponentsSplitter.doAddComponent(ThreeComponentsSplitter.java:542) at com.intellij.openapi.ui.ThreeComponentsSplitter.setLastComponent(ThreeComponentsSplitter.java:508) at com.intellij.openapi.wm.impl.ToolWindowsPane.setComponent(ToolWindowsPane.java:288) at com.intellij.openapi.wm.impl.ToolWindowsPane.addDecorator(ToolWindowsPane.java:201) at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doShowWindow(ToolWindowManagerImpl.kt:959) at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.showToolWindowImpl(ToolWindowManagerImpl.kt:912) at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow(ToolWindowManagerImpl.kt:628) at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$default(ToolWindowManagerImpl.kt:611) at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activated$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:1812) at com.intellij.openapi.wm.impl.StripeButton.lambda$new$0(StripeButton.java:63) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:401) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6654) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345) at com.intellij.openapi.wm.impl.StripeButton.processMouseEvent(StripeButton.java:300) at java.desktop/java.awt.Component.processEvent(Component.java:6419) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5029) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:971) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:906) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:838) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:452) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:505) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

OlliKiljunen commented 3 years ago

Hi @LingarajVB

and thank you very much for reporting this error!

We've encountered a similar error on a macOS machine. Your report confirms that this is a common problem, and we will take steps to fix it.

A possible workaround (before the error gets fixed): try to restart IntelliJ IDEA and re-try turning the project into A+ project. We noticed that could work when we encountered the same issue.

Thanks also for including all those details in your report; they are very helpful for us. :)

On behalf of the developer team, Olli Kiljunen

LingarajVB commented 3 years ago

@OlliKiljunen Thank you so much for addressing this. One more thing, I tried restarting, disabling/enabling, upgrading Intellij, recreating everything many times, but I am unable to get it work. I am getting the following option (as in below image) though after upgrading A+ plugin, but no progress I could make, I tried accessing both the options. I am only ending up with following error: Error message: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

image

Please help! Thank you so much in advance.

OlliKiljunen commented 3 years ago

This is primarily a note to our team but if you, @LingarajVB, are familiar with JDKs and certificates, you may find this useful, too. Otherwise, you have to wait for some of us to write more practical instructions.


Certificates for plus.cs.aalto.fi and/or grader.cs.aalto.fi must be imported into cacerts file inside /lib/security. The certificates can be downloaded with a browser and saved as .pem files. keytool command can be used to import .pem files in the cacerts file. Something like

keytool -import -alias grader-aalto-cs-fi -keystore path/to/jre/lib/security/cacerts -file path/to/grader-aalto-cs-fi.pem

It asks for a password which almost certainly is changeit.

The question we have left is where is the JRE located that is used by IntelliJ. On macOS, the default JRE is JetBrains Runtime which is located inside the .app folder of IntelliJ IDEA, whose location, then again, depends on whether it is installed via JetBrains Toolbox or not.


I'll continue with this issue later today/tomorrow but also, if @jaakkonarhi (who encountered the issue before) should want to check this out, that would be great.

LingarajVB commented 3 years ago

@OlliKiljunen

STEP 1) I was following the course instructions (on https://plus.cs.aalto.fi/o1/2020/w01/ch02, as per screenshot below) image

STEP 2) I added the above JDK to my empty project and then I executed as you instructed me (as below) though i could not find any JRE in that path. image

Please let me know if anything is not followed correctly in this (as i could not find the JRE in that openjdk version though, as you can see below) image

But, even after following the above steps, I am still facing this issue, unable to turn project into A+.

Please check once if the JDK version that I picked for this course is correct? And, did i miss a JRE path where i was supposed to execute these steps ?

There is also an option on intellij, not sure if that is the correct one, but i have tried that too (referring to below image):

image

Thank you so much in advance for all this help.

OlliKiljunen commented 3 years ago

Thank you again, @LingarajVB, for your reply!

You definitely has chosen the right JDK for your project (that is, v11.0.x; you chose AdoptOpenJDK as it was instructed although it most probably doesn't make any difference whose vendor's version you use). Anyway, everything's fine there! πŸ‘

There ain't any "JRE" inside adopt-openjdk-11.0.10 directory because that directory itself is the JRE (Java Runtime Environment), or even better, it is a JDK (Java Development Kit), which is a JRE + developer tools (such as compiler). If we want to only execute Java programs, we are fine with a JRE, but if we want to also develop them, we need a JDK. So what I referred to as <jre_home> in my previous message, would be that ~/Library/Java/JavaVirtualMachines/adopt-openjdk-11.0.10 directory. You could certainly find lib/security/cacerts file there BUT LET'S NOT FOCUS ON THAT NOW.

Because what I'm interested in here is not what is the JDK your project is built on, but what is the Java runtime (JRE/JDK) that IntelliJ IDEA itself is running on. You see, IntelliJ IDEA is a Java program and it is run on Java runtime. Typically, Java programs are run on a Java runtime that is specified by either JAVA_HOME or PATH environment variables of the operating system. However, IntelliJ IDEA has a logic of its very own to resolve which JRE it is run on. And on macOS, its default option (as far as I know) is to use a special "JetBrains Runtime" that is bundled with IntelliJ IDEA itself. If you can find IntelliJ IDEA CE.app (or IntelliJ IDEA U.app for Ultimate edition) directory which is perhaps located in /Applications or ~/Applications the JRE root is in IntelliJ IDEA CE.app/Contents/jbr/Contents/Home. There you can find lib/security/cacerts file that perhaps needs to be modified.

But before going that far, as a temporary solution, I'd suggest you try to change the Java runtime that IntelliJ IDEA uses. That can be done with Choose Runtime plugin that you can install to IntelliJ. Once installed press Shift key twice to open "Find everywhere" window and type "Choose runtime..." there and press enter. Now you can locate, for example that ~/Library/Java/JavaVirtualMachines/adopt-openjdk-11.0.10 and install it. Let's hope that works until we can fix the issue altogether (after changing the runtime IntelliJ shows a warning and suggest changing back but just ignore that until we are done with the issue).

AND EVEN BEFORE YOU TRY WHAT I INSTRUCTED ABOVE, please check what is the current version of (probably JetBrains Runtime?) your IntelliJ IDEA is running on. That happens by opening the about window and clicking "copy" icon (see screenshots below). After that you can paste the information to the reply field here. That would help us a lot to find out what is the root cause of the problem.

mac-screenshot-1

mac-screenshot-2

Best regards, Olli

LingarajVB commented 3 years ago

@OlliKiljunen (I was out of town, so checked today) I tried adding the certificate to intellij App's lib/security/cacerts and got the success message as well "Certificate was added to keystore": image But, No Luck! I was still unable to make the project an A+ project.

I installed the plugin (choose runtime) which you mentioned, but preferred not to experiment with it as i don't have a deeper experience in this. Pardon me for that.

I will surely be waiting for the fix. Please do it at the earliest, as you get bandwidth :pray:

### About my IDE Version:

IntelliJ IDEA 2020.3.3 (Ultimate Edition) Build #IU-203.7717.56, built on March 15, 2021

Runtime version: 11.0.10+8-b1145.96 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 2933M Cores: 8 Registry: scala.erase.compiler.process.jdk.once=false Non-Bundled Plugins: YAML/Ansible support, com.pinkfloyded.idea-file-path-autocomplete.idea-file-path-autocomplete, net.seesharpsoft.intellij.plugins.csv, name.kropp.intellij.makefile, org.intellij.scala, Pythonid

OlliKiljunen commented 3 years ago

Thank you for your reply! We continue on working on this.

OlliKiljunen commented 3 years ago

Hello again @LingarajVB !

Thanks to the detailed information you provided, we were able to test the issue with the same macOS version, the same IntelliJ version and the same version of JetBrains runtime. Despite of the environment being as identical as possible, we were, unfortunately, not able to reproduce the bug you described. In our test, the plug-in worked just as expected.

I'm afraid there's not much we can do anymore. The reason why our software acts differently on your machine, remains a mystery for us. Our best guesses are that the error is due to some of the following:

Some things you could still try if you want to (but there's no guarantee they would solve the problem):

If you want to, we can have a remote help session via Zoom at some time next week, but I don't know if it could solve the issue either, because you've already provided us with a very detailed information of the case. If you're willing to try that, you can send me an email to olli.kiljunen at aalto.fi, and we can appoint a time for it.

Unless nothing new comes up, we have no other choice but closing this ticket in a few days. Anyway, we are very thankful that you reported the issue and for all your patient cooperation.


Additional note (as a reminder): the plugin is designed to make it more convenient to download the template code modules, use the REPL, and submit assignments to A+ server. All of these can, however, be done manually, so using the plugin (or even IntelliJ) should not be mandatory for solving the course assignments. If you need help for, e.g., downloading and setting up the template code manually, you should primarily consult the personnel of the course (but, in your case, you can also ask us for help in that. Just send me an email).


Best regards, Olli

OlliKiljunen commented 3 years ago

Closed because the error couldn't be reproduced as explained above.

LingarajVB commented 3 years ago

Hello Again @OlliKiljunen ,

I installed the community edition but, unable to make any progress there as well. I am getting the same error which i used to get i.e., image

Due to this, I am unable to progress in the course as I am disappointed because of not able to fix my setup. I would really be grateful if you please help me over a call or something. I want to do all the assignments, I am really happy to have found out this material over the web, you guys have put in huge efforts in making this accessible to people like me across the globe. Hats off to all the people who are responsible for creating the content. Please do help me set this up so that I can take full advantage of it in learning Scala. I will surely be sending you an email.

Thanks for everything once again!

LingarajVB commented 3 years ago

Hi @OlliKiljunen , I figured out setting up these modules manually for now by downloading them from "https://grader.cs.aalto.fi/static/O1_2020/projects/o1_course_config.json" urls.

I will surely experiment on my own and will let you know if run into another problem, thank you so much πŸ™ Cheers!

OlliKiljunen commented 3 years ago

Great to hear, @LingarajVB!

I was just going to answer your previous message. Good that you find a work-around.

Once you have downloaded and extracted the source code ZIPs into the project folder, you can import them by right-clicking / ctrl-clicking the .iml file in the folder and choosing Import 'Whatever' module.

The modules of O1 course ("Programming 1") use Scala SDK 2.13.1. You can download that with IntelliJ by navigating to File -> Project Structure -> Libraries and clicking plus icon ("New project library") on top of the library list. Select Scala SDK and download version 2.13.1.

Those are basically the steps the plug-in normally would do for you. Perhaps you already solved those yourself.

If you use Scala REPL without A+ Courses plug-in, you have to import the packages you use by yourself before executing commands in the instructions of the course. Run for example import o1.goodstuff.gui_ to import members in that package.

Happy coding and learning!

LingarajVB commented 3 years ago

@OlliKiljunen Thank you for coming back. It looks like I have setup something wrongly, but not sure if it is correct, looks a bit odd. Please check this:

image

Although everything is working for me right now, I am even able to Play music in Scala REPL. But, (referring to above image) in my setup, I see a lot of O1Library Folders (inside each and every module). Is this correct setup ? Did i do anything wrong ? Did i duplicate it ? Because, The whole project seems huge now and contents of each and every O1Library/ folder are the same.

OlliKiljunen commented 3 years ago

Hi!

Good that is working. As they say: if it works, don't fix it! :D But indeed, the project structure is a bit different from what is the "correct" one. It doesn't, however, necessarily matter.

Anyway, here is what it should look like, if it was configured in the same way the plugin does it (with GoodStuff, IntroOOP and O1Library imported): image

And here is the directory tree (less important parts omitted with [...]):

Scala_Aalto_University_2020
β”œβ”€β”€β”€.idea
β”‚   └───[...]
β”œβ”€β”€β”€GoodStuff
β”‚   β”œβ”€β”€β”€doc
β”‚   β”‚   β”œβ”€β”€β”€lib
β”‚   β”‚   └───o1
β”‚   β”‚       β”œβ”€β”€β”€goodstuff
β”‚   β”‚       β”‚   └───gui
β”‚   β”‚       └───util
β”‚   └───o1
β”‚       └───goodstuff
β”‚           └───gui
β”œβ”€β”€β”€IntroOOP
β”‚   β”œβ”€β”€β”€doc
β”‚   β”‚   β”œβ”€β”€β”€lib
β”‚   β”‚   └───o1
β”‚   β”‚       └───util
β”‚   └───o1
β”œβ”€β”€β”€O1Library
β”‚   β”œβ”€β”€β”€conf
β”‚   β”œβ”€β”€β”€doc
β”‚   β”‚   └───[...]
β”‚   β”œβ”€β”€β”€lib
β”‚   β”œβ”€β”€β”€o1
β”‚   β”‚   β”œβ”€β”€β”€grid
β”‚   β”‚   β”œβ”€β”€β”€gui
β”‚   β”‚   β”‚   β”œβ”€β”€β”€colors
β”‚   β”‚   β”‚   β”œβ”€β”€β”€event
β”‚   β”‚   β”‚   └───layout
β”‚   β”‚   β”œβ”€β”€β”€sound
β”‚   β”‚   β”‚   β”œβ”€β”€β”€midi
β”‚   β”‚   β”‚   └───sampled
β”‚   β”‚   β”œβ”€β”€β”€util
β”‚   β”‚   β”‚   └───assignments
β”‚   β”‚   └───world
β”‚   β”‚       └───objects
β”‚   └───pics
β”‚       β”œβ”€β”€β”€illustrations
β”‚       └───lostgarden
└───out
    └───[...]

I can point a few differences between your configuration and mine:

Hope this helps. But as I said, if it works, there's no necessarily need to fix it.

Cheers, Olli

LingarajVB commented 3 years ago

@OlliKiljunen Finally, I was able to setup by following exactly each and every step you mentioned here. I can't thank you enough. πŸ™ I must be grateful of you for all the assistance you provided. A thousand thanks. I will surely keep this thread updated if I ever run into problems again (only if I am allowed to do so). Cheers !!!