I’m creating a WAR (TomcatHeartbeat.war) on my Windows machine and deploying it locally to Tomcat (v7.0.19). It deploys and runs without any errors.
I then take that same WAR and copy it (“deploy” it) to a CentOS Linux server, running the same version of Tomcat (but for Linux, obviously!) and get the following errors immediately:
2012-02-08 10:36:23,110 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO org.apache.catalina.startup.HostConfig- Deploying web application archive TomcatHeartbeat.war
2012-02-08 10:36:23,117 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.apache.catalina.startup.ContextConfig- Exception fixing docBase for context [/TomcatHeartbeat]
java.util.zip.ZipException: invalid END header (bad central directory offset)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
...(rest of stack trace ommitted for brevity)
I suspect this is a “Windows/Linux” thing? What else would explain the fact that the WAR runs perfectly fine on my machine but not on our Linux server?
I also suspect that the remedy will be to build & deploy the WAR right there on the same machine.
Am I on-track, or way off-base here? Thanks in advance!
Edit:
The method I am using to copy the WAR from Windows to Linux is:
- Copy the file from my local disk to a network directory, which is actually on a Linux machine, yet I have access to it through Windows Explorer
- FTP the WAR from that Linux machine to the application server (both Linux machines are same version of CentOS)
Are you definitely using BIN mode for FTP? The default is ASCII, which could play havoc with a .ZIP (or, of course, a .WAR) and could introduce corruption issues. I’d look at this first of all.
This is particularly likely with a command-line FTP operation; I believe UIs, certainly on Windows, mask it nicely.