Grails 5 app is constantly redeploying during development - grails

I had been using Grails 3.3.2 for about 3-4 years now and never had this issue. I just recently started migrating our apps to Grails 5 and now this started happening. Everytime I save a change to a file (gson, groovy, etc) the app redeploys and I have to wait a good 5-6 seconds before I can test it (url becomes available).
In Grails 5 my console looks like this when I make changes:
Grails application running at http://localhost:8081 in environment: development
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
Grails application running at http://localhost:8081 in environment: development
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
Grails application running at http://localhost:8081 in environment: development
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
Grails application running at http://localhost:8081 in environment: development
Each one of those Grails application running [...] lines is a 5+ second delay I have to wait through before the app comes back up
When I would work on my 3.3.2 projects my console would look like this during changes
Grails application running at http://localhost:8081 in environment: development
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
File C:\Workspaces\Intellij\ecpp\grails-app\controllers\ecpp\service\LookupSvcController.groovy changed, recompiling...
I never had to wait, I could immediately refresh the page and see the changes. Needless to say, my DEV time has taken a hit having to stop and wait for a redeploy. Is there some configuration I missed while upgrading that I can set to resolve this?
This happens while running the app with gradlew bootRun as well as grailsw run-app
Grails 5.1.7
JDK: 11.0.13

I just recently started migrating our apps to Grails 5 and now this
started happening. Everytime I save a change to a file (gson, groovy,
etc) the app redeploys and I have to wait a good 5-6 seconds before I
can test it (url becomes available).
The behavior you described is expected and by design.
Older versions of Grails were configured by default with a reloading agent. Grails 5 is not. The default behavior you will get with Grails 5 is a recompile and restart. If you don't want that behavior you can remove the devtools from your build.
You didn't ask about configuring a reloading agent but if you are interested, see the Spring Boot Developer Tools and Spring Loaded section at https://docs.grails.org/5.1.7/guide/single.html#upgrading33x.

Related

Can no longer deploy Grails 2.2.5 app on Tomcat

I have run into a very serious problem where I can longer deploy a war of a Grails 2.2.5 web application on Tomcat. The build (with 'grails war') proceeds without a problem, and I deploy it to Tomcat. I retsart Tomcat, and the web application simply does not run. It comes up with the deploying message, but clearly doesn't get as far as running Bootstrap.groovy, because logging from there doesn't show up in the log. No error messages are given, but the web app is simply not running.
I ran into a similar problem a few days ago on a different server which I solved by upgrading to Tomcat 7, but this one is already running Tomcat 7. I have no idea why this has started happening, unless it is something obscure to do with the recent change in Maven where only TLS 1.2 connections are allowed (a change which occurred a week or so ago).
So what could be happening? Is there some way I can log what is happening as the web app starts up, such that I might be able to see where the problem is occurring?
If it is of any relevance, it works OK when I do 'grails run-war' on my development machine.

Fatal slow performance after Grails 3 upgrade

I have updated small application to Grails 3.2.3. After some issues this is now resolved Grails 3.x update - bootRun failed
But unfortunately the application is unusable. On my high-end laptop ThinkPad 460p I cant even load home page of application. It's loading for ages and then CSS styles are not loaded at all. There is no error messages for grails run-app or IDEA Run Configuration.
I have no idea what to do now, all configuration is described here Grails 3.x update - bootRun failed
Thank you.
Chrome network profiling
Are you behind a company firewall? Are your pages trying to access remote javascript and/or css files? The process trying to access these may hang or timeout eventually.

Grails get stuck at "finished configuring Spring Security REST"

I type grails run-app and it begins to run, but it gets stuck on the message:
----------------------------------------
Current config:
baseDir: db/migration/global
env: DEVELOPMENT
dataSource: default
url: jdbc:postgresql://localhost:5432/mydbapp
username: postgres
schemas: public
----------------------------------------
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security REST ...
... finished configuring Spring Security REST
It used to run fine like an hour ago. No strange logs or anything. Also, when hit ctrl+c in the terminal, grails will close, but when I run-app again, it will say something like:
Error Server failed to start for port 8080: Address already in use (Use --stacktrace to see the full trace)
Indicating that grails wasn't really terminated. Of course, I kill the app occupying 8080 and run-app again, but it's still getting stuck.
The port 8080 is been used for another thread. Try to find a java thread in your system that you don't recognize and stop it.
How to on windows
How to on Linux
In BuildConfig.groovy, change your apps port. Example:
grails.server.port.http = 8003
If you still get port in use, exit IntelliJ, goto Task Manager, sort by memory used, end any processes with IntelliJ or Grails.
If you are using liquibase database migration tool and if you somehow stopped it before it finishes it will put a lock at DATABASECHANGELOGLOCK table. Change it to LOCKED = false and it will start.

Running more than one Grails application on Amazon's EC2

Can I run more than one Grails application on a virtual Linux machine in Amazon's cloud? I start one application on port 8080 and the other on say port 8090? Basically, I am trying to run two versions of the same application, one that testers can use to test and the other on which I can continue development. I seem to be able to launch the second application but I cannot get to it with my browser. The way I am doing it now is launching the first application by grails run-war and the development version with grails run-app of course. I can get to my first application by doing www.hostname.com:8080 but the one on www.hostname.com:8090 is not available in the browser.

How to make GlassFish web server use JRuby on Rails?

I installed Ubuntu, GlassFish web server, installed JRuby on Rails using GlassFish's admin tools, deployed my application from .war archive. The problem is only - when I attempt to run this web application nothing happens. GlassFish isn't listening on port 8080 as promised. The GlassFish administration web console listens on port 4848 and works fine. What to do to pair GlassFish and JRuby on Rails the correct way, remembering that it isn't a separate JRuby installation?
Update: it seems that this problem lies somewhere around access rights because I can deploy an application through
sudo ./asadmin deploy
but can not do the same through web console. The output is as if the application has been deployed, without any error messages (web interface shows the presence of application, domain folder contains my application's file/folder structure), but something in server's internals isn't bound to application.
I didn't think much and applied quick and dirty solution: set "777" access rights to /home/glassfish and all its contents. It helped.

Resources