Grails hangs on command line - grails

I just downloaded Grails 2.0.1.
Created a new project and then tried adding the mysql connector as per the documentation but Grails hangs at command prompt without any message. I tried to execute in verbose and stacktrace mode but it prints nothing.
I tried cleaning and re-executing but all the grails commands are getting stuck.
They don't print anything beyond "configuring classpath" message .
Please help.
Thanks

Cleaning .ivy cache helps
$HOME/.grails/ivy-cache

Had the same problem on grails 2.0.4.
The cause was one of the repos not responding and grails waits for it to timeout.
Setting log "verbose" in BuildConfig.groovy helped me find which repository caused the problem.

Try to add --offline to te command

$ grails clean --offline
worked for me, as I was stuck on configuring classpath due to unresolved dependencies.

Related

grails 2.5.4 won't start from terminal StackOverflowError

I'm running grails 2.5.4(I cannot upgrade the version), it successfully runs in my IDE (intellij) but I cannot get any grails command to run from the terminal. Even if I type just "grails" and nothing else, it will throw an error.
The error is:Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "main"
I can't seem to get anymore information out of it with --verbose
Also, I am running java 8
so I found out what was going on through excessive trial an error. The issue was that I had db2 installed on my machine. I don't know why that was causing the issue. But for anyone that might be running into this issue, that's what the problem was for me.
We had the same problem; in our case, all it took was an empty .inputrc file in the user's home directory to make grails work.

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

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.
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
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).
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.
It worked for me now.
this was my setting
GRAILS_HOME=C:\Users\murali.solayappan\apps\grails-3.1.11
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102
I received the same error while launching "grails" for the first time
**Error occurred running Grails CLI: connect timed out**
After reading GRAILS_HOME\bin\grails.bat i found that executing "grails" while in GRAILS_HOME dir makes some difference. So I did the same
Now i received error stating that GRAILS couldn't find a particular maven package from my mirror repository - printed my private nexus repository url. I know that's my private repo and not connected to internet.
so I changed the MY_HOME_DIR.m2\"settings.xml" with the one came by default in Maven.
After that executed "grails" while in %GRAILS_HOME% dir.
It worked like breeze !!! I got grails prompt.
C:\Users\murali.solayappan\apps>grails
| Enter a command name to run. Use TAB for completion:
grails> exit
Somethimes it happens when you have wrong version of grails installed for the project you want to run it on
try to run it somewhere else and see if you get the same error
i had the same issue because i was using Grails 1.3.5 witj Java 8 which are incompatibles. I changed with Java 7 and it works fine.

grails 3.0.1 proxy settings

I am new to Grails 3.0.1 and wonder how and where to set the correct Proxy settings. I know what my proxy configuration is - IP and port, but don't know where to place.
I am getting errors like these when trying to run grails command within my helloworld project:
ivo#ivotrisquel:~/grails/projects/helloworld$ grails --stacktrace
| Error Problem updating profiles from origin git repository (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.eclipse.jgit.api.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
at org.grails.cli.profile.git.GitProfileRepository.fetchAndRebaseIfExpired(GitProfileRepository.groovy:140)
at org.grails.cli.profile.git.GitProfileRepository.createOrUpdateRepository(GitProfileRepository.groovy:109)
at org.grails.cli.profile.git.GitProfileRepository.getProfile(GitProfileRepository.groovy:56)
at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:347)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:192)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:99)
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:524)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1115)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
... 6 more
Caused by: java.net.ConnectException: Connection timed out github.com
at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:175)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:475)
... 11 more
| Error Problem updating profiles from origin git repository
I had the same problem and solved it adding the proxy configuration to the GRAILS_HOME/bin/grails.bat file in the following way:
>set GRAILS_OPTS=%GRAILS_OPTS% -Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort -Dhttp.proxyUser=bob -Dhttp.proxyPassword=theBuilder
I believe there must be another way to configure the proxy in Grails 3.0.x but I haven't found it so far.
Regards
In linux adding the configuration
export GRAILS_OPTS="-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort"
in the GRAILS_HOME/bin/grails.sh file. Resolve my problem in Netbeans 8.1
I adedd the following to my ~/.grails/ProxySettings.groovy file.
client=['http.proxyHost':'myproxy', 'http.proxyPort':'myport', 'http.proxyUser':'myusername', 'http.proxyPassword':'mypass', 'http.nonProxyHosts':'localhost']
currentProxy='client'
For GRAILS3 there is now enough documentation on how to setup proxy.
As said by #campos, in Windows you must
set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort
but that makes correction only for half the way, because you also have to correct gradle engine, inserting in its gradle.properties values as below
systemProp.http.proxyHost=proxy.yourdomain.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=yourpass
systemProp.http.nonProxyHosts=localhost
There is complete explanation here and here for gradle. With all that on my Windows10 I can correctly compile and build packages behind my corporate proxy.
After long struggle I found the solution for windows environment
The following worked for me
set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort -Dhttp.proxyUser=bob -Dhttp.proxyPassword=theBuilder

grails-2.4.3 not working?

I just downloaded grails 2.4.3 and created a test application, but it fails when trying to run the application.
Anybody knows why its going wrong here?
Thanks
C:\workspace\grails_apps\testApp>grails run-app
| Running Grails application
Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing : C:\Program%20Files%20(x86)\Grails\grails-2.4.3\lib\org.springframework\springloaded\jars\springloaded-1.2.0.RELEASE.jar
| Error Forked Grails VM exited with error
C:\workspace\grails_apps\testApp>
For anyone interested,
this problem was solved by moving the grails installation from
C:\Program Files (x86)\Grails\grails-2.4.3
to
C:\Grails\grails-2.4.3
eg. by removing the spaces in the GRAILS_HOME path as explained in the post found here.
Note, it did not work to remove the spaces by setting GROOVY_HOME = C:\PROGRA~2\Grails\grails-2.4.3

Grails App fails to deploy to Heroku?

I have developed a Grails application and have deployed it many times to Heroku without an issue. However just recently I have changed the solution to use plugins from within a folder I have called "plugins". I have then basically added the following code to the BuildConfig in order to include those plugins in the application:
grails.plugin.location.'spring-security-ui'="plugins/grails-spring-security-ui"
Now when I run the delpoy to Heroku I get the following error:
|Generating plugin.xml for inline plugin
Error |
Error executing script War: java.lang.NullPointerException: Cannot get property 'file' on null object (Use --stacktrace to see the full trace)
! Failed to build app
! Heroku push rejected, failed to compile Grails app
I think this is due to the new plugins I have added to the solution via the new method. Can anyone tell me if I am missing something or what is wrong??
Also I have tested this locally and runs fine :-S
Thanks
EDIT 1......
I have tried to build the WAR file locally i got the following:
Building WAR file.....
| Error Exception occurred trigger event [CreateWarStart]: /home/admin/workspace/APP_NAME/grails-app/migrations does not exist. (Use --stacktrace to see the full trace)
| Done creating WAR target/APP_NAME-0.1.war
Try grails war locally to see if you can reproduce the problem.
This might possibly be related to GRAILS-9006 which was fixed in 2.0.4.
From trying multiple different things I have found that Heroku is rubbish at handling local plugins within Grails. So I moved over to Jelastic and runs like a dream :-)
Thanks for the help!!

Resources