Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

War file cannot be opened by Tomcat

 
james qin
Greenhorn
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(ContainerBase.java:795)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
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
Saloon Keeper
Pie
Posts: 17989
47
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic