MopeSWTP-SS21 / MopeSWTP

MIT License
1 stars 0 forks source link

Cant start mope server in IntelliJ #31

Closed manuEbg closed 3 years ago

manuEbg commented 3 years ago

After I build the mope server I want to start it via the the run cammand in the (in IntelliJ integrated) sbt shell.

The Mope Server starts but fails to locate the omc file that is configured in mope.conf. The Path to the File is definitivly correct and it is working when i start the sbt shell from terminal. When i use the integrated terminal in IntelliJ to navigate to the folder where omc is located and type ls, omc is also not displayed.

We have absolutly no idea how to continue.

Also I am not sure if my buildconfiguration is correct, since I think the server should start when i hit the play button. but this only builds the project and opens the sbt shell...

@CSchoel We absolutly need Your Help on this one. Since it is pretty much stopping us from starting development and we are loosing hope to find the solution alone. Probably we should find a date when you will help us to start with the development?

CSchoel commented 3 years ago

I can't reproduce the issue on my Manjaro system with IntellIJ IDEA Ultimate 2019.

Steps to produce a working "run" command:

I also tested the same behavior by typing run in the sbt-shell and by previously removing my existing configuration file ~/.config/mope/mope.conf.

Maybe this is a windows issue? Can you be more specific about the steps you tried and the error message?

CSchoel commented 3 years ago

Also as a side note: You can configure what the "Play" button does by creating a run configuration and choosing the sbt Task template. This is especially helpful if you need to supply some parameters to the JVM or the server process.

CSchoel commented 3 years ago

I have one vague idea what the source of the error may be: What does your mope.conf look like? Mine is the following:

#application mode; DEV or PROD
app.mode = DEV

http.interface = localhost
http.port = 9001

#which compiler to use?
#Currently we are supporting OpenModelica (omc) and JModelica (jm)
compiler = omc

#where is the compiler?
#Either the OpenModelica compiler-executable called "omc" or
#the "IPython script" delivered from JModelica, which should be located at:
#${JMODELICA_HOME}/IPython
compilerExecutable = "omc"

#always english error messages?
forceEnglish = true

#stop server after all clients left?
exitOnLastDisconnect = false

#timeout (seconds) for actors asking other actors
defaultAskTimeout = 60

#index files or retrieve files always when compiling?
indexFiles = true

mote {
  #moveExecutable = "/usr/bin/move.jar"
}

simulation {
  numberOfIntervals = 100
}

It seems to me that the default config assumes that the omc executable can be found in the PATH environment variable. Is this the case on your system? If not, what happens if you add it to the path and only use the string "omc" in mope.conf like in the example above?

CSchoel commented 3 years ago

If this does not solve your problem, we can try to solve it together via PILOS. You can reach me in the matrix chat until 12:00 p.m. or between 4:00 p.m. and 6:00 p.m. today. Tomorrow I am available starting from 2:00 p.m..

CSchoel commented 3 years ago

Another thought: If the terminal in IntellJ and the system terminal do not show the same contents for a folder, you have a really weird system configuration that might be the issue here.

manuEbg commented 3 years ago

Thank you for your Quick Response.

We use IntelliJ Community 2021.1.1 on Pop!_OS 20.10

[info] 2021-05-06 11:32:26,041 [INFO ] d.t.m.s.Server [Server(akka://moie-system)] - MoPE-server - Version: 0.7.2 - Development
[info] 2021-05-06 11:32:26,148 [ERROR] d.t.m.s.Server [Server(akka://moie-system)] - Your configuration (/home/swtp/.config/mope/mope.conf) contains the following errors:
[info]  - `compilerExecutable`: omc wasn't executable: Cannot run program "omc": error=2, No such file or directory
[error] Nonzero exit code returned from runner: 2
[error] (Compile / run) Nonzero exit code returned from runner: 2
[error] Total time: 12 s, completed May 6, 2021, 11:32:29 AM
[IJ]sbt:MoPE-server> 

I think OMC should already be part of my PATH

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

mlocate -r /omc$
/home/swtp/omc
/home/swtp/.local/share/Trash/files/omc-java-api/src/main/java/omc
/home/swtp/.local/share/Trash/files/omc-java-api/src/test/java/omc
/home/swtp/MoPE/omc-java-api/build/classes/java/main/omc
/home/swtp/MoPE/omc-java-api/build/classes/java/test/omc
/home/swtp/MoPE/omc-java-api/build/generated-src/antlr/main/omc
/home/swtp/MoPE/omc-java-api/src/main/java/omc
/home/swtp/MoPE/omc-java-api/src/test/java/omc
/home/swtp/SRC/MoPE/omc-java-api/src/main/java/omc
/home/swtp/SRC/MoPE/omc-java-api/src/test/java/omc
/usr/bin/omc
/usr/include/omc
/usr/lib/omc
/usr/lib/x86_64-linux-gnu/omc
/usr/share/omc
/usr/share/doc/omc

using th e full patho of omc (/usr/bin/omc) in mope.conf leads to

[info] 2021-05-06 11:30:32,799 [INFO ] d.t.m.s.Server [Server(akka://moie-system)] - MoPE-server - Version: 0.7.2 - Development
[info] 2021-05-06 11:30:32,960 [ERROR] d.t.m.s.Server [Server(akka://moie-system)] - Your configuration (/home/swtp/.config/mope/mope.conf) contains the following errors:
[info]  - `compilerExecutable`: /usr/bin/omc wasn't executable: Cannot run program "/usr/bin/omc": error=2, No such file or directory
[error] Nonzero exit code returned from runner: 2
[error] (Compile / run) Nonzero exit code returned from runner: 2
[error] Total time: 112 s, completed May 6, 2021, 11:30:35 AM

i gave /usr/bin/omc chmod 777 which doesnt change a thing...

I changed Project SDK which doesnt change a thing... import3

Deleting mope.conf doesnt change a thing...

manuEbg commented 3 years ago

Another thought: If the terminal in IntellJ and the system terminal do not show the same contents for a folder, you have a really weird system configuration that might be the issue here.

Yes i think this is very strange and I have no Idea why.

The IntelliJ Terminal also does not know commands such as sudo or mlocate. Also every Line in the shell starts with sh-5.1$. I am not exactly sure what this means...

manuEbg commented 3 years ago

If this does not solve your problem, we can try to solve it together via PILOS. You can reach me in the matrix chat until 12:00 p.m. or between 4:00 p.m. and 6:00 p.m. today. Tomorrow I am available starting from 2:00 p.m..

Friday 2:00p.m. Sounds good to me!

CSchoel commented 3 years ago

I could do a quick test run with the development environment myself, if I had the encryption key. @manuEbg , could you give me the key through some secure channel (e.g. Matrix).

CptKaNe commented 3 years ago

Every password is listed in our Wiki. Section Developement Environment, at the top.

CSchoel commented 3 years ago

Is IntelliJ already installed in the current version of the environment downloadable from the HessenBox? It does not seem so at first glance.

CptKaNe commented 3 years ago

Is IntelliJ already installed in the current version of the environment downloadable from the HessenBox? It does not seem so at first glance.

you are correct, the latest version is without intellij, because we updated the vm only in case, we were finished with a specific task, which works.

@manuEbg did you install IntelliJ via Terminal? Cuz I'm trying to get to your error point too and want to set up the environment exactly as you did. Besides, I am downloading the ultimate edition because of our free THM License for it. But this should not affect the error situation, i guess.

CSchoel commented 3 years ago

New hunch: 90% sure that flatpak is your problem. As far as I understand it from the video, flatpak, which is the suggested form of installation for IntelliJ via the Pop! Shop, uses some form of containerization to install apps on different OSes. That's fine and all, but that also means that the shell you get in IntellIJ actually isn't a shell in your Pop! OS, but inside the container. This explains why you see a totally different filesystem in the shell than you see in a separate terminal application.

CSchoel commented 3 years ago

@CptKaNe Can you tell me if installing via apt, or whatever Pop! uses, resolves the issue? I have to attend to some other stuff for a short while.

CptKaNe commented 3 years ago

i am currently trying to install it via snap. Therefore i set up snap via this instruction: https://snapcraft.io/docs/installing-snap-on-pop and then downloaded Intellij described on jetbrains website following the steps in the last section "install as a snap package on linux": https://www.jetbrains.com/help/idea/installation-guide.html#snap

More Information when I am finished and followed the steps you listed above

CSchoel commented 3 years ago

Snap is also a containerized system and will therefore likely have the same problems as flatpak.

What is it with kids and all their fancy schmanzy containers these days... :older_adult: :angry: :anger: :joy:

CptKaNe commented 3 years ago

Snap is also a containerized system and will therefore likely have the same problems as flatpak.

What is it with kids and all their fancy schmanzy containers these days... 🧓 😠 💢 😂

Ah okay, i did not think of this fact. what i can say after starting intellij, that both the external terminal and intellijs are showing exactly the same filesystem and the omc is listed in its folder.

nevertheless i cant pass the step "In IntelliJ: File -> New... -> Project from existing sources... -> Select mope-server/build.sbt"

After selecting the build.sbt file i get the message "Cannot import anything from /home/swtp/MoPe/mope-server/build.sbt

CSchoel commented 3 years ago

Quick update:

sudo add-apt-repository ppa:mmk2410/intellij-idea
sudo apt-get update
sudo apt-get install intellij-idea-community

With this I get the same "Cannot import" error as @CptKaNe - probably, because Scala support isn't pre-installled in this version of the community edition. However, I can run the OMC from the IntelliJ terminal without problems.

I also found this related reddit thread: https://www.reddit.com/r/pop_os/comments/ksgp2v/mvn_command_not_found_only_in_intellij_terminal/ If you do not want do add unofficial PPAs to apt, the JetBrains Toolbox might really be the way to go instead.

manuEbg commented 3 years ago

I installed intelliJ via POP!_Shop. And it definitly uses flatpak! I had no Idea what this meant, but now it all makes sense:)

Scala Support is not preinstalled in the Community Edition. However once you open a Scala File IntelliJ suggest to download scala plugin.

I am Reopening #11 and i will have a look on JetBrains Toolbox and flatpak tomorrow

CSchoel commented 3 years ago

This works perfectly fine for me in your VM. Case closed, I guess.

You can probably still use the flatpak version, if you use the --filesystem parameter suggested in the Reddit thread, but I would stay clear of unnecessary containerization. It is neither good for performance, nor for storage space, and as we have seen it can make configuring development tools quite a bit trickier. My suggestion would be to try the JetBrains Toolbox. I have downloaded and installed IntelliJ manually in the past and it was quite simple. I guess the Toolbox adds still another layer of comfort.

CptKaNe commented 3 years ago
* File -> Settings -> Plugins -> Install the Scala plugin -> Restart

* Open (from the splash screen when not project is opened, alternatively the good old File -> New... -> Project from existing sources... ) -> select `build.sbt`

* from here on out the same as in the previous comment: [#31 (comment)](https://github.com/MopeSWTP-SS21/MopeSWTP/issues/31#issuecomment-833336780)

This works perfectly fine for me in your VM. Case closed, I guess.

You can probably still use the flatpak version, if you use the --filesystem parameter suggested in the Reddit thread, but I would stay clear of unnecessary containerization. It is neither good for performance, nor for storage space, and as we have seen it can make configuring development tools quite a bit trickier. My suggestion would be to try the JetBrains Toolbox. I have downloaded and installed IntelliJ manually in the past and it was quite simple. I guess the Toolbox adds still another layer of comfort.

Confirmed using the Toolbox & adding the scala plugin, works perfectly! Thanks for your help on this one, I guess Manu wasted hours on that. At least i wasted the whole day for it.

CSchoel commented 3 years ago

You're welcome. :smile:

I would not consider the time wasted, as long as you learned something.