aspose file tools*
The moose likes Tomcat and the fly likes War file cannot be opened by Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "War file cannot be opened by Tomcat " Watch "War file cannot be opened by Tomcat " New topic
Author

War file cannot be opened by Tomcat

james qin
Greenhorn

Joined: May 09, 2014
Posts: 1
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

Joined: Jun 25, 2001
Posts: 16145
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Consider Paul's rocket mass heater.
 
subject: War file cannot be opened by Tomcat