Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Error occurred running Grails CLI: null" when running grails 3.0 command line

Tags:

grails

I'm trying to run grails list-profiles, but receive the following error:

snowch@snowch-ws2:~/repos$ grails list-profiles --stacktrace
| Error Error occurred running Grails CLI: null (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NullPointerException
    at org.grails.cli.profile.git.GitProfileRepository.getAllProfiles(GitProfileRepository.groovy:72)
    at org.grails.cli.profile.commands.ListProfilesCommand.handle(ListProfilesCommand.groovy:43)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:173)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:99)
| Error Error occurred running Grails CLI: null

My versions are:

snowch@snowch-ws2:~/repos$ grails --version
| Grails Version: 3.0.1
| Groovy Version: 2.4.3
| JVM Version: 1.7.0_75

This was on a fresh install of grails and gvm.

The command grails create-app myapp works without error.

This question is similar to Grails 3.0 error, nullpointer, however, that question does not state what command is being run.

like image 998
Chris Snow Avatar asked Apr 20 '15 21:04

Chris Snow


3 Answers

I had same experience when I was working on "Building an Andoird Client" guide, I got the following message whenever I try to create an app in the same folder where I've created the first app grails-app : | Error Error occurred running Grails CLI: null (Use --stacktrace to see the ful l trace) So obviously, when you create a grails app in folder containing "grails-app" directory, grails will consider this folder as full grails application, hence cannot create-app in that directory. I used: Grails 3.1.15 Java 1.8.0.101 Hope this help.

like image 57
Ibrahim.H Avatar answered Oct 11 '22 23:10

Ibrahim.H


After searching online, I found that I needed to set my GRAILS_OPTS environment variable as follows before running the command:

export GRAILS_OPTS="-XX:-UseSplitVerifier -Xverify:none"

Source of fix: https://grails.org/news/1292028

like image 5
Chris Snow Avatar answered Oct 11 '22 22:10

Chris Snow


I have not figured out, what is the exact cause of the error, but it seems to occur if you try to run grails 3 in the system where grails 2 is also installed.

What I did to get the command run - I created the project in a new directory. The directory for my old grails app was: /home/me/projects/oldgrailsapp

when I tried to execute the grails command in /home/me/projects it failed, but when I tried this in another directory /home/me/projects_new, it succeeded. So I guess that the problem was that old grails configuration was somehow interfering with the new one.

I also removed references to old grails and groovy versions from the PATH variable by editing .bashrc file in my home directory (I really do not know if it was needed).

like image 2
MF.OX Avatar answered Oct 12 '22 00:10

MF.OX