0

I am frustrated ... What is ApplicationEventMulticaster and how can I initialize or refresh it? Why it is needed?

# java -Dgrails.env=production -jar /root/myapp-0.4.war 

Configuring Spring Security Core ...
... finished configuring Spring Security Core

2017-09-05 22:46:07.948 ERROR --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@46dffdc3: startup date [Tue Sep 05 22:45:58 CEST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414)
    at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
    at grails.boot.GrailsApp$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at haselnuss3.Application.main(Application.groovy:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:531)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)

How or where I have to call this refresh action?! I have no glue. It is my first Grails App I try to run on a server. In Localhost everything is running fine.

System (Dev, works):

  • Mac
  • Grails 3.3.
  • MySQL
  • java version "1.8.0_112"

System (Production, works not!)

  • Ubuntu Server 14.04 LTS
  • Grails Version: 3.3.0
  • Groovy Version: 2.4.11
  • JVM Version: 9-internal
  • MySQL
Fusca Software
  • 709
  • 6
  • 11
  • Please add more details to your question: what version of grails are you using? what is your setup? do you use external lib? – lifeisfoo Sep 05 '17 at 20:58
  • `grails -version | Grails Version: 3.3.0 | Groovy Version: 2.4.11 | JVM Version: 9-internal ` – Fusca Software Sep 05 '17 at 20:59
  • Possible duplicate of [ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context](https://stackoverflow.com/questions/45318618/applicationeventmulticaster-not-initialized-call-refresh-before-multicasting) – lifeisfoo Sep 05 '17 at 20:59
  • Yes the error is similar, but I use Grails and not Spring Framework and not any pom or xml file, so the answer in the other question is completely useless for me. It also does not answer the question what ApplicationEventMulticaster is and how to refresh it. – Fusca Software Sep 05 '17 at 21:13
  • This is likely an issue with something else failing. Try turning up logging and re run it. If you can reproduce it in a fresh app please share that as well. – erichelgeson Sep 05 '17 at 22:46
  • Ok, I just installed grails on the server (I wanted to avoid), run `grails create-app ...` and wanted to start it by `grails run-app` also then, I get the error above. I did change nothing. – Fusca Software Sep 06 '17 at 07:36
  • @FuscaSoftware Grails framework is based on Spring framework – lifeisfoo Sep 06 '17 at 08:38
  • How many memory has your production server? Also take a look [at this grails issue](https://github.com/grails/grails-core/issues/10395) – lifeisfoo Sep 06 '17 at 08:45
  • It's VServer from Hosteurope: 32GByte. In the named issue the solution is to clean gradle/m2, this leads to the next error for me: `grails run-app | Error Error occurred running Grails CLI: No profile found for name [web]. (Use --stacktrace to see the full trace)` – Fusca Software Sep 06 '17 at 12:51

1 Answers1

0

I fixed it like this:

  • uninstall tomcat/java support in Plesk
  • apt-get remove java
  • apt-get remove openjdk*
  • apt-get install openjdk-8-jdk
  • cd [app-path]
  • grails run-app

and it worked! so the java "9-internal" environment was not working with grails-apps (3.3.0). :(

After that

java -Dgrails.env=production -jar /root/my-app.war 

was also perfectly running!

Fusca Software
  • 709
  • 6
  • 11