Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

War file cannot be opened by Tomcat  RSS feed

james qin
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I generated a war package with gradle War plugin,but this war cannot be opened by Tomcat,following is the exception :

2014-5-9 15:34:17 org.apache.catalina.startup.HostConfig deployWAR
严重: Error deploying web application archive XXXXXXX1.war
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException: Error initializaing : java.lang.NullPointerException
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployWAR(
at org.apache.catalina.startup.HostConfig.deployWARs(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
2014-5-9 15:34:18 org.apache.coyote.http11.Http11AprProtocol start

But I put all files of the war under a folder of webapps of Tomcat,Tomcat can run the web app normally,I don't know why and I have no idea about how to locate questions of the war,please help me ,thank you very much!

Tim Holloway
Posts: 18662
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your stack trace is incomplete and that there should be a few "Caused by" items in it.

To troubleshoot a WAR file, simply unzip it. To be valid, there should be a WEB-INF/web.xml file unzipped to the directory that you unzipped it to (NOT a subdirectory of that directory - meaning no "xxxxxxx/WEB-INF/web.xml or anything like that). There should also be a WEB-INF/classes and WEB-INF/lib directory. Plus the other parts of the WAR in their respective placed.

To deploy the WAR, remove any existing copies of both the WAR file itself and a directory with the same name (minus the .war extension), if it exists. Copy a fresh WAR into TOMCAT_HOME/webapps and make sure its extension is ".war" (case sensitive). Also make sure that the user ID under which Tomcat is running has access rights to read the WAR and to write to the TOMCAT_HOME/webapps directory.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!