0

I am seeing the following error message while trying to execute grails run-war. It works fine with grails run-app. Later I realized it is not only related to grails. Even if I create war and deploy it on tomcat, I am seeing the same error message. But not sure how to debug more. Looks like some kinds of conflict with tomcat default jar.

Grails version: 2.5.2
Tomcat Version: `build ":tomcat:7.0.55.3"`
|Done creating WAR target/ROOT.war
|Running Grails application
    A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/sms]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/sms]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 6 more
    Caused by: java.lang.NullPointerException
    at org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer.getSources(SpringApplicationWebApplicationInitializer.java:62)
    at org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer.onStartup(SpringApplicationWebApplicationInitializer.java:48)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5479)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more
    A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341)
    at org.grails.plugins.tomcat.fork.TomcatWarRunner.doStart(TomcatWarRunner.groovy:114)
    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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at org.grails.plugins.tomcat.TomcatServer.start(TomcatServer.groovy:141)
    at grails.web.container.EmbeddableServer$start.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 org.grails.plugins.tomcat.fork.ForkedTomcatServer.runInternal(ForkedTomcatServer.groovy:86)
    at org.grails.plugins.tomcat.fork.ForkedTomcatServer.run(ForkedTomcatServer.groovy:66)
    at org.grails.plugins.tomcat.fork.ForkedTomcatServer$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:117)
    at org.grails.plugins.tomcat.fork.ForkedTomcatServer.main(ForkedTomcatServer.groovy:60)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more
    | Error Error loading Tomcat: Failed to start component [StandardServer[-1]] (Use --stacktrace to see the full trace)
    Error |
    Forked Grails VM exited with error
Maicon Mauricio
  • 2,052
  • 1
  • 13
  • 29
Balkrishna
  • 2,897
  • 3
  • 23
  • 31
  • After digging into more on this issue I realized on of the following jar causing this trouble, digging more. Now tomcat is running. spring-boot-1.3.1.RELEASE.jar spring-boot-autoconfigure-1.3.1.RELEASE.jar spring-boot-cli-1.3.1.RELEASE.jar spring-boot-loader-tools-1.3.1.RELEASE.jar – Balkrishna Aug 03 '16 at 15:09

2 Answers2

3

Finally realized spring-boot-cli-1.3.1.RELEASE.jar jar causing this trouble. Which is I think downloaded as a part of following dependencies.

<dependency>
   <groupId>org.grails</groupId>
   <artifactId>gorm-hibernate4-spring-boot</artifactId>
   <version>5.0.8.RELEASE</version>
</dependency>

Changing above to following resolved the issue.

<dependency>
   <groupId>org.grails</groupId>
   <artifactId>gorm-hibernate4-spring-boot</artifactId>
   <version>5.0.8.RELEASE</version>
   <scope>provided</scope>
</dependency>

I think this jar is conflicting with tomcat boot process. For more information follow following threads.

A child container failed during start java.util.concurrent.ExecutionException

java.lang.ClassNotFoundException: HttpServletRequest

Community
  • 1
  • 1
Balkrishna
  • 2,897
  • 3
  • 23
  • 31
0

If you encounter this error with Grails 5 and above due to the grails-shell dependency conflicting with spring-boot-cli while initializing the war in Tomcat, you can resolve this issue by making the following changes to your build.gradle:

1. Using rootSpec.exclude:

bootWar {
    rootSpec.exclude("**/spring-boot-cli-*.jar")
}

2. Classpath filtering:

bootWar {
    classpath = classpath.filter { !it.name.startsWith("spring-boot-cli") }
}

3. Using configurations exclude with a flag property:

First, set the deploy property (-Pdeploy) as a flag in your build command. Then, use the following code block to exclude the problematic dependency:

if (hasProperty('deploy')) {
    configurations.configureEach {
        exclude group: "org.grails", module: "grails-shell"
    }
}

These changes should help resolve the dependency conflict and allow your application to work smoothly with Grails 5 and above. Make sure to apply these changes to your build.gradle file and rebuild your project to see the effect.

Maicon Mauricio
  • 2,052
  • 1
  • 13
  • 29