Problem with live reload Grail 4

519 views
Skip to first unread message

Pabel Dionicio Lopez Mena

unread,
Jun 17, 2020, 11:45:14 AM6/17/20
to Grails Dev Discuss
how to deactivate the live reload of grails 4 and reactivate the hot reload that was in grails 3, I am having many problems with this given that I can wait a long time for my program to restart for every change I make

Puneet Behl

unread,
Jun 17, 2020, 2:24:42 PM6/17/20
to Grails Dev Discuss

Hi



The default option is Spring Boot Developer Tools, which should be faster than a normal restart. You could disable it by removing the following dependency from the classpath. 



 developmentOnly
("org.springframework.boot:spring-boot-devtools")



To add back the option for hot-reloading from Grails 3, add the following in your build.gradle file:



 configurations
{
   agent
 
}

 dependencies
{
    agent
"org.springframework:springloaded:1.2.8.RELEASE"
    runtimeOnly
"io.methvin:directory-watcher:0.9.6" // (Optional) Native OSX file watcher
 
...

 
}


Please note that springloaded only supports JDK8 and is no longer maintained. An alternative, more complete paid solution is JRebel.


Reference: https://github.com/grails/grails-core/pull/11441


---

Puneet Behl

Pabel Dionicio Lopez Mena

unread,
Jun 17, 2020, 3:53:56 PM6/17/20
to Grails Dev Discuss

ok i will try and let know my experience with this solution

Pabel Dionicio Lopez Mena

unread,
Jun 17, 2020, 5:13:09 PM6/17/20
to Grails Dev Discuss
I executed the changes that you mentioned in grails 4.0.1 and they worked for me without problems, but when I use them in grails 4.0.3 I get the following error


2020-06-17 17:10:46.025 ERROR --- [nio-8080-exec-4] o.g.web.errors.GrailsExceptionResolver   : NoSuchFieldException occurred when processing request: [GET] /abacus/registrar_horas_extras
$staticClassInfo$. Stacktrace follows:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'abacus.EmpleadosController': Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: java.lang.NoSuchFieldException: $staticClassInfo$
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:73)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: java.lang.NoSuchFieldException: $staticClassInfo$
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.lambda$buildPersistenceMetadata$0(PersistenceAnnotationBeanPostProcessor.java:424)
at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:694)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:423)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:407)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:567)
... 17 common frames omitted
Caused by: java.lang.NoSuchFieldException: $staticClassInfo$
at java.lang.Class.getDeclaredField(Class.java:2070)
... 24 common frames omitted





El miércoles, 17 de junio de 2020, 14:24:42 (UTC-4), Puneet Behl escribió:

puneet....@gmail.com

unread,
Jun 22, 2020, 4:08:59 AM6/22/20
to Grails Dev Discuss
Hi

I tried to test reloading with Grails 4.0.3 which seems to work fine. However, I think the above problem could be related to the Groovy version conflict but I am not so sure. 

elgallolopez...@gmail.com

unread,
Jun 22, 2020, 4:48:27 PM6/22/20
to Grails Dev Discuss
what version for groovy you used ?

Puneet Behl

unread,
Jun 22, 2020, 5:58:23 PM6/22/20
to Grails Dev Discuss
I have tested with the default version shipped with Grails 4.0.3. I am guessing there might be some plugin that is fetching an older version of Groovy. Normally, you would see under Intellij Idea > External Libraries if there are multiple versions of Groovy. Also, it would be great if you could share a sample application. 

demon...@gmail.com

unread,
May 19, 2022, 3:01:52 AM5/19/22
to Grails Dev Discuss
I have issue with java.lang.IllegalStateException: java.lang.NoSuchFieldException: $staticClassInfo$
It happance after some updates in the controller-service code. Not on every change, but quite often. Any way to solve it? 


понедельник, 22 июня 2020 г. в 23:58:23 UTC+2, Puneet Behl:

Michał Szulc

unread,
Jun 14, 2023, 7:07:35 PM6/14/23
to Grails Dev Discuss
Has anyone found a solution for Grails4 "java.lang.IllegalStateException: java.lang.NoSuchFieldException: $staticClassInfo$" since?
If so: which version of https://repo.spring.io/ui/repos/tree/General/libs-snapshot-local/org/springframework/springloaded/ are you using?
Reply all
Reply to author
Forward
0 new messages