1
votes

When I make changes to a controller, it appears hot reloading is breaking with the following errors:

2018-01-26 19:37:43.752 ERROR --- [Loader@14dad5dc] o.s.loaded.CurrentLiveVersion            : Unexpected exception whilst trying to call the static initializer on com.emmanuj.cleena.Requestmap
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.CurrentLiveVersion.runStaticInitializer(CurrentLiveVersion.java:311)
        at org.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:433)
        at org.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:1018)
        at org.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:104)
        at org.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:251)
        at org.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:235)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError
        at com.emmanuj.cleena.Requestmap$$EQhtIzZ2.___clinit___(Requestmap.groovy)
        ... 11 more
2018-01-26 19:37:43.770 ERROR --- [Loader@14dad5dc] o.s.loaded.CurrentLiveVersion            : Unexpected exception whilst trying to call the static initializer on com.emmanuj.cleena.Role
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.CurrentLiveVersion.runStaticInitializer(CurrentLiveVersion.java:311)
        at org.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:433)
        at org.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:1018)
        at org.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:104)
        at org.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:251)
        at org.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:235)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError
        at com.emmanuj.cleena.Role$$EQhtIzZ2.___clinit___(Role.groovy)
        ... 11 more
2018-01-26 19:37:43.827 ERROR --- [Loader@14dad5dc] o.s.loaded.CurrentLiveVersion            : Unexpected exception whilst trying to call the static initializer on com.emmanuj.cleena.User
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.CurrentLiveVersion.runStaticInitializer(CurrentLiveVersion.java:311)
        at org.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:433)
        at org.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:1018)
        at org.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:104)
        at org.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:251)
        at org.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:235)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError
        at com.emmanuj.cleena.User$$EQhtIzZ2.___clinit___(User.groovy)
        ... 11 more
2018-01-26 19:37:43.897 ERROR --- [Loader@14dad5dc] o.s.loaded.CurrentLiveVersion            : Unexpected exception whilst trying to call the static initializer on com.emmanuj.cleena.UserRole
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.CurrentLiveVersion.runStaticInitializer(CurrentLiveVersion.java:311)
        at org.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:433)
        at org.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:1018)
        at org.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:104)
        at org.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:251)
        at org.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:235)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalAccessError
        at com.emmanuj.cleena.UserRole$$EQhtIzZ2.___clinit___(UserRole.groovy)
        ... 11 more

Not sure how to access the full stacktrace but it looks like this is happening for Spring Security classes with the @GrailsCompileStatic annotation. I've the following configurations:

  • Grails 3.3.2
  • spring-security-core plugin v3.3.2
  • spring-security-rest plugin v2.0.0.M2; and
  • JVM 1.8

Update: It appears this error is happening after I make changes in my controller and then run the compile command from the grails interactive prompt.

I have this too in 3.3.2 Have to constantly restart the appAugust