title: micronaut already associated with parent beanfactory error running grails 4 app on standalone tomcat 8.5
body: <p>Tomcat 8.5.71
  Grails 4.0.11
  RHEL 7.8</p>
  <p>The application runs fine with the embedded tomcat but won't load with standalone.  Stacktrace is:</p>
  <p>java.lang.IllegalStateException: Error starting child
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/gdbxt]]
  at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
  ... 9 more
  Caused by: java.lang.IllegalStateException: Already associated with parent BeanFactory: io.micronaut.spring.context.factory.MicronautBeanFactory@347aa4db: defining beans []; root of factory hierarchy
  at org.springframework.beans.factory.support.AbstractBeanFactory.setParentBeanFactory(AbstractBeanFactory.java:718)
  at org.springframework.context.support.GenericApplicationContext.setParent(GenericApplicationContext.java:158)
  at org.springframework.boot.builder.ParentContextApplicationContextInitializer.initialize(ParentContextApplicationContextInitializer.java:58)
  at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:623)
  at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:367)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
  at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
  at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
  at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitializer.groovy:57)
  at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
  at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
  ... 10 more</p>
  <p>war file built for standalone tomcat has build.gradle with</p>
  <pre><code>provided &quot;org.springframework.boot:spring-boot-starter-tomcat&quot;
  </code></pre>
  <p>I have</p>
  <p>server:
  port: 8091</p>
  <p>in application.yml and also have the connector set to 8091 in the tomcat server.xml</p>
  <p>This app is ported from grails 2.5.5. and is quite large with a number of additional dependencies.  It has quartz jobs which I disabled with quartz.pluginEnabled: false in application.yml.</p>
  <p>It does get as far as running bootstrap.groovy since it prints out some logging from that code.</p>
  <p>Can someone point me to a possible cause of this sort of error?</p>